Unable to Update Local Ref on Git Pull: 4 Ways to Fix it

Optimize the directory and check for bad reference

Reading time icon 2 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

Key notes

  • To fix the unable to update local ref error, run the git prune command.
  • You can also delete the corrupt or broken reference to fix this.
fix unable to update local ref

Many users reported getting the unable to update local ref error when executing the Git Pull or Git Push command.

This usually happens due to a mismatch in the commit IDs or due to permission issues when the local repository is created as a different user.

How do I fix the unable to update local ref error?

Before we try more complex solutions, try restarting your PC and ensuring that you can access project files. Also, keep Git updated and check the names of the branches for mismatches.

1. Optimize the local directory

  1. Open your console.
  2. Run the following commands:
    $ git gc --prune=no
    $ git remote prune origin

The first command cleans up the unnecessary files. It’s recommended to run it in each repository for optimal disk usage and better performance.

The second, remote prune, command removes the old, unused remote-tracking branches.

Remember, you may have to run the second command more than once to fix the unable to update local ref error.

2. Update the reference

  1. Start the console
  2. Use the following command: $ git update-ref -d refs/remotes/origin/[branch name]

Here, [branch name] refers to the branch that’s throwing the error due to a Commit ID mismatch. Once done, you can continue with the Git Pull or Git Push command.

3. Check for a bad reference

  1. Open the command line.
  2. Run the following command: rm .git/refs/remotes/origin/master

4. Delete the corrupt or broken references after a BSOD

  1. Open File Explorer.
  2. Navigate to refs/remotes/origin/
  3. Delete the references.

You can also access them by navigating to: %repo_root%/.git/refs/remotes/origin/some/branch

One of these solutions should help fix the unable to update local ref Git error. Remember, there are several underlying causes, but in most cases, the git prune command should do the trick! It works for 7 out of 10 users.

A similar set of fixes works with the Not possible to fast-forward, aborting error. This isn’t the only issue you can encounter, and users reported GitHub Desktop not opening, but we covered that in another guide.

For any queries or to share what worked for you, drop a comment below.