Re: [Bug] cloning a repository with a default MASTER branch tries to check out the master branch
- From
Samuel Lijin <sxlijin@gmail.com>
- Date
- May 23, 2017, 08:01 UTC
- Message-ID
- <CAJZjrdWXsuKrFzedLvyE-1mvD0RC5XYDkmvV3wRNWXjFAVt4iQ@mail.gmail.com>
- In-Reply-To
- <CACQm2Y1QtKD3M6weNhGrAQSLV8hLF4pKcpHDD7iUc78aWrt6Cw@mail.gmail.com>
For some reason the repo on GH does not have a HEAD pointer:
$ git ls-remote https://github.com/passcod/UPPERCASE-NPM.git efc7dbfd6ca155d5d19ce67eb98603896062f35a refs/heads/MASTER e60ea8e6ec45ec45ff44ac8939cb4105b16477da refs/pull/1/head f35a73dcb151d336dc3d30c9a2c7423ecdb7bd1c refs/pull/2/head 0d9b3a1268ff39350e04a7183af0add912b686e6 refs/tags/V1.0.0 efc7dbfd6ca155d5d19ce67eb98603896062f35a refs/tags/V1.0.1
I'm not sure how you managed to do that, since GH rejects attempts to delete the current branch, but I believe if you set the default branch to MASTER it will work correctly.
On Mon, May 22, 2017 at 5:42 PM, Félix Saparelli <felix@passcod.name> wrote:
Show 42 quoted lines
> Hi, > > I created a git repository that, for joke reasons, has a single branch > called MASTER (in uppercase). Upon cloning this repo, git attempts to > checkout the master branch (in lowercase), which does not exist. > Checking out the MASTER branch manually afterwards works. > > $ git clone git@github.com:passcod/UPPERCASE-NPM.git > Cloning into 'UPPERCASE-NPM'... > remote: Counting objects: 14, done. > remote: Compressing objects: 100% (11/11), done. > remote: Total 14 (delta 3), reused 14 (delta 3), pack-reused 0 > Receiving objects: 100% (14/14), done. > Resolving deltas: 100% (3/3), done. > warning: remote HEAD refers to nonexistent ref, unable to checkout. > > $ cd UPPERCASE-NPM > $ ls -a > . .. .git > $ git branch > $ git checkout MASTER > Branch MASTER set up to track remote branch MASTER from origin. > Switched to a new branch 'MASTER' > $ ls -a > . .. .git NPM package.json README > $ git branch > * MASTER > > Some platform information: > > $ git version > git version 2.12.2 > > $ uname -a > Linux felix-probook 4.10.13-1-ARCH #1 SMP PREEMPT Thu Apr 27 12:15:09 > CEST 2017 x86_64 GNU/Linux > > Git was installed from the default Arch Linux package. > > Thanks, > Félix >