threads / discuss / 58371

Ambiguous 'HEAD' issue.

Subject: Ambiguous 'HEAD' issue.

## tl;dr

7 messages between Aug 27, 2022 and Sep 8, 2022.

replies: 6people: 5as markdown or json

Caglar Akyuz· Aug 27, 2022, 20:42 UTC · lore
Hello,
Recently I changed one of my repo's origin URL from gitlab to github.  After this switch, I start getting:
  warning: refname 'HEAD' is ambiguous.
messages when I use 'git status'. I check various things if I have tags/branches to blame but cannot find anything:
* git show-ref | grep -i head -> nothing suspicious
* find . -name HEAD | grep -v modules -> only .git/logs/HEAD and .git/HEAD
* git branch -a | grep HEAD -> nothing
Do you have any suggestions for a possible fix to this?

Thanks, Caglar

Felipe Contreras· Aug 28, 2022, 01:00 UTC · re: Caglar Akyuz · lore

Re: Ambiguous 'HEAD' issue.

On Sat, Aug 27, 2022 at 5:15 PM Caglar Akyuz <caglar.akyuz@sparsetechnology.com> wrote:

> Recently I changed one of my repo's origin URL from gitlab to github.  After this switch, I start getting:
>
>   warning: refname 'HEAD' is ambiguous.
> * git show-ref | grep -i head -> nothing suspicious
Are you sure? You don't have a ref called "HEAD"? Just "HEAD".
-- 
Felipe Contreras
Caglar Akyuz· Aug 28, 2022, 08:31 UTC · re: Felipe Contreras · lore

Re: Ambiguous 'HEAD' issue.

From: Felipe Contreras <felipe.contreras@gmail.com>
Sent: Sunday, August 28, 2022 4:00 AM
To: Caglar Akyuz <caglar.akyuz@sparsetechnology.com>
Cc: git@vger.kernel.org <git@vger.kernel.org>
Subject: Re: Ambiguous 'HEAD' issue. 
 
On Sat, Aug 27, 2022 at 5:15 PM Caglar Akyuz
<caglar.akyuz@sparsetechnology.com> wrote:
>> Recently I changed one of my repo's origin URL from gitlab to github.  After this switch, I start getting:
>>
>>   warning: refname 'HEAD' is ambiguous.
>> * git show-ref | grep -i head -> nothing suspicious
> Are you sure? You don't have a ref called "HEAD"? Just "HEAD".
I don't see just "HEAD".  "git show-ref | grep HEAD" doesn't show anything if that's what you mean.

Thanks, Caglar

Junio C Hamano· Aug 29, 2022, 06:36 UTC · re: Caglar Akyuz · lore

Re: Ambiguous 'HEAD' issue.

Caglar Akyuz <caglar.akyuz@sparsetechnology.com> writes:
> * find . -name HEAD | grep -v modules -> only .git/logs/HEAD and .git/HEAD
plus "grep HEAD .git/packed-refs"
> * git branch -a | grep HEAD -> nothing
plus "git for-each-ref | grep HEAD"
Caglar Akyuz· Aug 29, 2022, 06:57 UTC · re: Junio C Hamano · lore

Re: Ambiguous 'HEAD' issue.

From: Junio C Hamano <jch2355@gmail.com> on behalf of Junio C Hamano <gitster@pobox.com>
Sent: Monday, August 29, 2022 9:36 AM
To: Caglar Akyuz <caglar.akyuz@sparsetechnology.com>
Cc: git@vger.kernel.org <git@vger.kernel.org>
Subject: Re: Ambiguous 'HEAD' issue. 
 
>Caglar Akyuz <caglar.akyuz@sparsetechnology.com> writes:
>> * find . -name HEAD | grep -v modules -> only .git/logs/HEAD and .git/HEAD
>plus "grep HEAD .git/packed-refs"
This is empty as well.
>> * git branch -a | grep HEAD -> nothing
>>plus "git for-each-ref | grep HEAD"
This is empty output also.
Both 'grep HEAD .git/packed-refs' and 'git for-each-ref | grep HEAD'  commands return nothing and still 'git status' is complaining about ambiguous HEAD.

Thanks, Caglar

Jeff King· Sep 8, 2022, 01:34 UTC · re: Caglar Akyuz · lore

Re: Ambiguous 'HEAD' issue.

On Mon, Aug 29, 2022 at 06:57:00AM +0000, Caglar Akyuz wrote:
> Both 'grep HEAD .git/packed-refs' and 'git for-each-ref | grep HEAD'
> commands return nothing and still 'git status' is complaining about
> ambiguous HEAD.

Is it possible for you to tar up your .git directory and share it (either publicly, or privately to individual developers)?

-Peff
Johannes Sixt· Sep 8, 2022, 06:27 UTC · re: Caglar Akyuz · lore

Re: Ambiguous 'HEAD' issue.

Am 29.08.22 um 08:57 schrieb Caglar Akyuz:
> Both 'grep HEAD .git/packed-refs' and 'git for-each-ref | grep HEAD'
> commands return nothing and still 'git status' is complaining about
> ambiguous HEAD.

Are you on a case-insensitive filesystem? Does `find .git -iname head -print` report anything that is not named uppercase HEAD?

-- Hannes

← back to recent threads