Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"HEAD not found below refs/heads" after I push commit with CR/CRLF changes

Tags:

git

I have local repository, and a remote bare repository. I've made changes to my local files, and other guy has made changes too, but he just sent me files. I've copy-pasted them in my local tree and committed. On commit I've got messages on files that I have copy-pasted

LF will be replaced by CRLF

I've just committed all the files and pushed them to remote bare repository. And when on remote I run

git branch

I get the next error message

HEAD not found below refs/heads!

Now it seems to me that this is because of these files with CR instead of CRLF.

Any suggestions? Will appreciate any help on how to handle such situations/fix my repo.

like image 683
Vitaliy Lebedev Avatar asked Dec 18 '11 12:12

Vitaliy Lebedev


2 Answers

It looks like the HEAD on your remote is pointing to an invalid branch. You can view what it's pointing to with:

git symbolic-ref HEAD

and fix it to point at a valid branch with:

git symbolic-ref HEAD refs/heads/branch-that-exists
like image 93
CB Bailey Avatar answered Nov 19 '22 15:11

CB Bailey


I get the next error message

HEAD not found below refs/heads!

It means that 'HEAD' points outside of 'refs/heads'. For example, in my case it was pointing into 'refs/remotes'

git symbolic-ref HEAD

refs/remotes/coreclr/master

I had to edit 'HEAD' to fix the issue:

git symbolic-ref HEAD

refs/heads/master

like image 3
John Doe Avatar answered Nov 19 '22 17:11

John Doe