Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git pull error :error: remote ref is at but expected

Tags:

git

git-pull

pull

Full message:

error: Ref refs/remotes/origin/user is at 3636498c2ea7735fdcedc9af5ab3c8689e6abe77 but expected a21359c6cc2097c85775cde6a40105f4bd7100ec From github.com:{github project url}  ! a21359c..6273ffc  user -> origin/user  (unable to update local ref) 
like image 200
Sanjeev Kumar Dangi Avatar asked Aug 03 '12 13:08

Sanjeev Kumar Dangi


People also ask

How do I fix broken references in git?

Solution. Unsure the root cause of the "reference broken". To fix it, delete this file . git/refs/remotes/origin/master , and git fetch to retrieve it back.

Does git pull affect remote?

The short answer is simple: no, the remote-tracking branch remains unaffected.

How do I force git pull?

Forcing Git Pull The key command to force a git pull from a remote repository is git reset --hard origin/master . The other commands are to ensure you don't lose any data, by making a backup! First, git fetch --all syncs up our remote to our local.


1 Answers

If you are running git under a file system that is not case sensitive (Windows or OS X) this will occur if there are two branches with the same name but different capitalisation, e.g. user_model_changes and User_model_changes as both of the remote branches will match the same tracking ref.

Delete the wrong remote branch (you shouldn't have branches that differ only by case) and then git remote prune origin and everything should work

like image 68
krijesta Avatar answered Sep 26 '22 15:09

krijesta