Vitalii Lebediev
Vitalii Lebediev

Reputation: 662

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

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.

Upvotes: 10

Views: 12043

Answers (2)

John Doe
John Doe

Reputation: 131

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

Upvotes: 3

CB Bailey
CB Bailey

Reputation: 792677

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

Upvotes: 19

Related Questions