I only have branch master and im getting this error every time i try to \"git pull\":
error: Couldn\'t set refs/remotes/origin/master
From /var/lib/git/xxx/p
What worked for me was:
git config --global fetch.prune true
Now it keeps on running prune automatically.
I had the same error, I was updating from within Eclipse and I got many errors. So I tried updating from a DOS command window, and got the same issue.
Then I tried the solution " git gc --prune=now " This gave messages that the files were locked in the refs directory.
Eclipse must have had a locked on something in the "refs" directory.
The solution I found was to simply close Eclipse.
Then I updated the repository from DOS with a " git PULL " command, and everything worked fine.
What happened over here?
The local references to your remote branches were changed and hence when you run git pull, git doesn't find any corresponding remote branches and hence it fails.
git remote prune origin
actually cleans this local references and then run git pull again.
Suggestion - Please run with --dry-run option for safety
I discoverd the same Error message trying to pull from a Bitbuck Repo into my lokal copy. There is also only one Branche Master and the command git pull origin master lead to this Error Message
From https://bitbucket.org/xxx
* branch master -> FETCH_HEAD
error: Couldn't set ORIG_HEAD
fatal: Cannot update the ref 'ORIG_HEAD'.
Solution as follows
git reflog find the number of the last commitgit reset --hard <numnber> reset to the last commit git pull origin master pull again without errorwith gitbach line commande, use git update-ref to update reference of your local branch:
$ git update-ref -d refs/remotes/origin/[locked branch name]
then pull using $ git pull
[locked branch name] is the name of the branch that the error is happening because of mismatch of commit Ids.
This happened to me on OSX where I use a case insensitive file system. Somehow another developer pushed a branch with the same name but different case: My-Branch vs my-branch.
I already had My-Branch checked out and got the error "unable to update local ref" when I did a pull probably because the file system thinks My-Branch == my-branch.
Since we use Github I could solve the problem by deleting one of the branches via Github's GUI.