Unable to Update Local Ref on Git Pull: 4 Ways to Fix it
Optimize the directory and check for bad reference
2 min. read
Updated on
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.
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
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
- Start the console
- 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
- Open the command line.
- Run the following command:
rm .git/refs/remotes/origin/master
4. Delete the corrupt or broken references after a BSOD
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.
User forum
0 messages