Git error on git pull (unable to update local ref)

user115561 picture user115561 · Apr 9, 2012 · Viewed 128.1k times · Source

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/project
 ! a0f80ea..49177a3  master     -> origin/master  (unable to update local ref)

and when i do "git pull origin master" i get:

error: Couldn't set ORIG_HEAD
fatal: Cannot update the ref 'ORIG_HEAD'.

i have been searching but cant find why

Answer

Skipjack picture Skipjack · Dec 3, 2014

My team and I ran into this error, unable to update local ref, when doing a pull in SourceTree.

We used :

git gc --prune=now

This removes any duplicate reference objects which should fix the issue.

Here are a few links where you can learn more about git references and pruning :

git tip of the week

git-prune documentation

git references