git Warning: remote HEAD refers to nonexistent ref, unable to checkout git Warning: remote HEAD refers to nonexistent ref, unable to checkout git git

git Warning: remote HEAD refers to nonexistent ref, unable to checkout


I found out what was going wrong. The problem was that I wasn't paying attention to the warnings when I was pushing to my gitosis server so I didn't realize that I wasn't pushing a particular branch. I had assumed it would just push the current but that isn't the case until you set:

git config push.default current


  1. Do the git branch -r and git checkout -b master <remotebranchofinterest>

  2. Check the HEAD file in remote .git.

  3. Check if somebody already asked the question: here


One more possible cause for this warning might be that the master branch in the repository is missing (OR) the repository does NOT use a master branch. If this is the case, just don't worry about the Warning!, use

git checkout <some_existing_branch>

The warning is because, by default, after the pull git tries to checkout into the master branch.