I cannot clone any repository anymore.
$ git clone [email protected]:myaccount/myrep.git
Cloning into 'myrep'...
conq: repository does not exist.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
The thing is my ssh id_rsa
key is still the same. I recreated it anyway, updated it in my BitBucket
account's ssh keys, and the same error shows up when I try to clone my repository. I tried the very same procedure on another machine (redhat) and git clone worked. So there is something happening with git
.
Then I went in another git versioned project:
$ cd share-repo
$ ls -a
./ ../ .git/ .gitignore* f1* f2*
I print the git config
file:
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:myaccount/share-repo.git
[branch "master"]
[user]
name = myaccount
I try a pull
:
$ git pull -v
conq: repository does not exist.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Okay let's try a a push?
$ git push -v origin master
Pushing to [email protected]:myaccount/p2.git
conq: repository does not exist.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Huh? Git
tries to push to repository p2? It should try pushing to share-repo
... How in the hell is it trying to push to a repository which name is p2? Indeed, I had a repo named p2
this morning, but I deleted it from my BitBucket
account while doing some tests, then I removed the related folder p2
from my computer. How did git
retain information about p2
? And above all, where is it stored, how can I reset it?
$ git remote -v
origin [email protected]:myaccount/p2.git (fetch) # ?!
origin [email protected]:myaccount/p2.git (push) # ?!
origin [email protected]:myaccount/share-repo.git (push)
Strange, as we saw previously the git config
file only holds information regarding the repo share-repo
. Also I tried locating the string p2 in the whole folder:
$ grep -Rin p2 ../share-repo/
# Nothing
I manually recreated a repository named p2
in Bitbucket
. I tried to clone it:
$ cd ..
$ git clone [email protected]:myaccount/p2.git
Cloning into 'p2'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
$ cd p2
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = [email protected]:myaccount/p2.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
$ git remote -v
origin [email protected]:myaccount/p2.git (fetch)
origin [email protected]:myaccount/p2.git (push)
origin [email protected]:myaccount/p2.git (push)
Okay, the git clone
worked, but now it referenced two extra lines for the remotes, one of which is duplicated. Remember those extra lines when working with the repo share-repo
? It's about those very first two lines which are still related to the old p2 repo I had deleted.
Let's try to push some changes:
$ git touch .gitignore
$ git add .gitignore
$ git commit -m "first commit"
$ git push -v origin master
Pushing to [email protected]:myaccount/p2.git
Counting objects: 3, done.
Writing objects: 100% (3/3), 216 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To [email protected]:myaccount/p2.git
* [new branch] master -> master
updating local tracking ref 'refs/remotes/origin/master'
Pushing to [email protected]:myaccount/p2.git
To [email protected]:myaccount/p2.git
= [up to date] master -> master
updating local tracking ref 'refs/remotes/origin/master'
Everything up-to-date
So git pushed to repo p2, and tried to do so a second time since the two repos have the same name and same location on my bitbucket
account, so it obviously found that everything was up to date.
Now I could clone any repository I want, provided the repo p2
exists in my Bitbucket
account. If I wanted to push
some changes in let's say share-repo
, it would work, but git would also try to push the same changes to the repository p2
. That's quite a mess I got myself into and I don't know how to solve it.
To sum up, I had this morning a repository called p2
which I deleted from bitbucket
, then I deleted it's folder from my computer. Since then, whichever git project I cd
into, git remote -v
shows me it has stored - somewhere - information related to the late repo p2
, on top of the current repo I am working on. Git updating commands - clone, push, pull - won't work unless I create back this damn repo p2
on Bitbucket
. Once I do so, git updating commands will apply the commands to the current repo I'm working on, as well as to the repo p2.
p2
is not the only repository I deleted today, so I am quite curious to know what happened here.
I will gladly take all the help I can get.
~/.gitconfig
for a[remote "origin"]
section.~/.git
file using tab completion and did not find any. Now looking carefuly (ls -a ~/
) there is indeed the~/.gitconfig
file with the information on that remote. Thanks a lot. Don't you want to make an answer on that, so that I validate it?