You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a repository uses a default branch whose name is not "master", Gitea still maintains the .git/HEAD file with the content: "ref: refs/heads/master", and even if you try to explicitly set or update the default branch using the Settings/Branches page, it does not change the content of the HEAD file. Consequently, when you try to clone such a repository on your local machine, you get a warning from git: "warning: remote HEAD refers to nonexistent ref, unable to checkout." and then you have to explicitly checkout the default branch of the repository.
[x]
):Description
When a repository uses a default branch whose name is not "master", Gitea still maintains the .git/HEAD file with the content: "ref: refs/heads/master", and even if you try to explicitly set or update the default branch using the Settings/Branches page, it does not change the content of the HEAD file. Consequently, when you try to clone such a repository on your local machine, you get a warning from git: "warning: remote HEAD refers to nonexistent ref, unable to checkout." and then you have to explicitly checkout the default branch of the repository.
Exact steps to reproduce the issue are given below (tested and confirmed on https://try.gitea.io/vg-c/testdefaultbranch):
$ mkdir testdefaultbranch
$ cd testdefaultbranch
$ git init
$ touch README
$ git add README
$ git commit
$ git branch -m master newbranch
$ git branch -vv
$ cat .git/HEAD
ref: refs/heads/newbranch
$ git remote add origin https://try.gitea.io/vg-c/testdefaultbranch.git
$ git push -u origin newbranch
...
Counting objects: 3, done.
Writing objects: 100% (3/3), 192 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://try.gitea.io/vg-c/testdefaultbranch.git
Branch newbranch set up to track remote branch newbranch from origin.
$ cd ..
$ mkdir t
$ cd t
$ git clone https://try.gitea.io/vg-c/testdefaultbranch.git
Cloning into 'testdefaultbranch'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.
$ cat testdefaultbranch/.git/HEAD
ref: refs/heads/master
The text was updated successfully, but these errors were encountered: