Git ‘fatal: No such ref: HEAD’

You’ve lost your HEAD so you’ll need to recreate it. The simplest thing to do is this.

echo ref: refs/heads/master >.git/HEAD

Now you should be able to run other git commands and see where you’re at.

(Although, in theory, you could attempt to do git symbolic-ref HEAD refs/heads/master newer git versions don’t recognize a .git as a git repository unless it already contains a HEAD so this won’t work to create a new one.)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)