Git pull fails : unable to update local ref

20,903

Solution 1

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.

Solution 2

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

Share:
20,903
Stanislav O Chernykh
Author by

Stanislav O Chernykh

Updated on July 05, 2022

Comments

  • Stanislav O Chernykh
    Stanislav O Chernykh almost 2 years

    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.