Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So we have a branch in our git repo called creative_market. I run the command git checkout --track origin/creative_market which works fine. All of the changes that should be on the creative_market branch are present. However, if I run git pull I get this error:

Your configuration specifies to merge with the ref 'creative_market' from the remote, but no such ref was fetched.

In addition, if I do git pull origin creative_market I get:

fatal: Couldn't find remote ref creative_market

fatal: The remote end hung up unexpectedly

Running a git branch -a clearly shows:

remotes/origin/creative_market

And my .git/config file shows:

[branch "creative_market"]
    remote = origin
    merge = refs/heads/creative_market

Which lines up with everything else in my .git/config file.

I am stumped here. Any ideas?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

The message you're getting can indicate that the creative_market branch no longer exists in the remote repository. Could this be the case?

You can fix it with the following commands:

git checkout --track origin/creative_market
git push origin creative_market

Another, slightly longer, way to prove what's happening is to do the following:

First, make a backup ref with the command git branch creative_market2 origin/creative_market. Then, run git fetch -p to prune remote-tracking branches that no longer exist on the remote. If the branch was indeed deleted from the remote, you'll see something like the following:

[my-repository]$ git fetch -p
 x [deleted]         (none)     -> origin/creative_market

To re-create the branch on the remote repository, simply push your local ref to it:

git push --set-upstream origin creative_market2:creative_market
share|improve this answer
    
Thanks Stephen. I believe you are right that the branch didn't exist anymore, so I fixed it by doing git checkout --track origin/creative_market and then pushing it via git push origin creative_market which seems to have fixed everything. I'm guessing your solution will work as well, so I'll mark it as correct. Thanks again! –  Mike Lentini May 7 '12 at 16:10
    
@MikeLentini That's a much quicker fix, I added it into my answer. Thanks. –  Stephen Jennings May 7 '12 at 22:58

Prune the local remote copy of the branch

git fetch -p

Remote the upstream of the local branch

git branch --unset-upstream
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.