This morning I went to do a git fetch and got the following error:
fatal: No remote repository specified. Please, specify either a URL or a remote name from which new revisions should be fetched.
This used to work fine. It looks like git has forgotten the link between (all) my branches and the repository.
Typing git remote -v
doesn't return anything.
It was working at the end of last week, and the only thing that I can think of that I have changed was installing the latest GitExtensions release. However right now I am more worried about whether there is some way I can get back the repository information.
Any ideas?
Update:
My .git/config file was empty. Although I don't know the cause, I was able to remote desktop to another computer in the company and retrieve the "remote" section of its config.
I have updated my config file, and so far it looks like it is working :-)
Update 2: I have also needed to relink the branches to the origin via:
git config branch.develop.remote origin
git config branch.develop.merge refs/heads/develop
etc
You can take a look on .git/config and configure it.
You can also make your local branch track back your remote branch by typing
git branch --set-upstream <localbranch> <remotebranch>
When you type git fetch
the local branch will fetch codes from those tracking remote branch.
Seems like a very old question, but want to update to Kit Ho's answer with slight modification. Might be useful for someone.
git branch --set-upstream <localbranch> <remotebranch>
is deprecated as of git version 1.9.2. This is the correct syntax now,
git branch --set-upstream-to=<upstream>
An example would be,
git branch --set-upstream-to=originremote/testbranch
Remote information should be stored in the .git/config file, check that file and see if it's corrupted. If it is you might have to re-add every remote you had before or do a clean checkout, if it is there, there might be a bug in the GitExtension release...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With