Stanislav O Chernykh
Stanislav O Chernykh

Reputation: 69

Git pull fails : unable to update local ref

I'm totally messed with my git repository. I can't push / pull remote branch..it disappeared from git extensions...

I use Git Extensions 2.33 , msysgit Git-1.7.11-preview20120710.exe

C:\Program Files (x86)\Git\bin\git.exe pull --progress "biometric" +refs/heads/try_merge:refs/remotes/biometric/try_merge
error: unable to resolve reference refs/remotes/biometric/try_merge: No such file or directory
From biometric.bmstu.ru:test
 ! [new branch]      try_merge  -> biometric/try_merge  (unable to update local ref)
Done


$git fsck output

error: bad ref for refs/remotes/biometric/try_merge

When i try to push something to remote git thinks that it is a brand new branch for remote repository. How can I recover it?

Sorry for bad english. Thanks for any help.

Upvotes: 3

Views: 24998

Answers (2)

Andreas Bergström
Andreas Bergström

Reputation: 14640

I had this issue and fixed it by simply removing the troublesome branch in .git/refs/remotes/origin/ and then do git fetch again.

Upvotes: 2

Christopher
Christopher

Reputation: 44284

You've reversed the matching ref syntax, looks like. It should be <remote_ref>:<local_ref>, but otherwise it looks like you're just attempting to pull biometric/try_merge and force it into your local's try_merge. Try this:

git checkout try_merge
git pull --force biometric try_merge

Otherwise I think this will work if you'd like to keep the matching ref syntax:

git pull biometric +try_merge:try_merge

Let me know in comments if these still throw your error, but either should work.

Upvotes: 0

Related Questions