3

When I do git fetch, nothing happens, even though I can see that my origin/master is behind the one on GitHub. The only output I get from git fetch is

$ git fetch origin From github.com:myname/myrepo * branch master -> FETCH_HEAD 

The output I want is

$ git fetch From github.com:myname/myrepo 6a6a103..77edb9d master -> origin/master * [new branch] feature -> origin/feature 

when I run git ls-remote:

$ git ls-remote From [email protected]:myname/myrepo.git 77edb9d40be3a75bd25288ab375ef16e009267fa HEAD 77edb9d40be3a75bd25288ab375ef16e009267fa refs/heads/master <-- latest 9f2c06129eefef3f1cdc96499058d7b58e2ad0b6 refs/heads/feature 

but git show-ref gives me

$ git show-ref e4d894a2db19c3dbbdb946b25142c981695e0790 refs/heads/master 9f2c06129eefef3f1cdc96499058d7b58e2ad0b6 refs/heads/feature 6a6a10322110a690044e267eb7644613057dd932 refs/remotes/origin/master <-- old! 

Why won't git fetch do anything?

2 Answers 2

4

If there is a way to fix this via the command line?

You can use a git config command (to fetch again all remote branches):

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" 
Sign up to request clarification or add additional context in comments.

Comments

3

origin's refspec is hosed. The refspec is the part of the remote configuration that tells git what to fetch and how. It is described in more detail here.

In .git/config there is a section

[remote "origin"] url = [email protected]:myname/myrepo.git 

This should look like

[remote "origin"] url = [email protected]:myname/myrepo.git fetch = +refs/heads/*:refs/remotes/origin/* 

If there is a way to fix this via the command line, I am not aware of it. I also do not know why this happened.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.