Skip to contentSkip to conversation

git clone through http bug?

DISCUSSION Sergei Organov 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

I've just cloned the public repo (it's rather small):

$ git clone http://ydirson.free.fr/soft/git/cvsps.git

and it has created cvsps/.git, but no working copy. When I examine the contents, I also notice that while the file .git/HEAD has:

ref: refs/heads/master

there is no .git/refs/heads/master file (the directory .git/refs/heads is empty).

Now, if I first clone the original repository as --bare, and then make a usual local clone from it, the local clone looks file:

$ git clone --bare http://ydirson.free.fr/soft/git/cvsps.git
$ git clone cvsps.git cvsps.cloned

Is it a problem with clone over http, a problem with the repository, or it's me who does something wrong?

-- Sergei.

#1 lore raw
Quoted 7 lines · Sergei Organov

Hello,

I've just cloned the public repo (it's rather small):

 $ git clone http://ydirson.free.fr/soft/git/cvsps.git

and it has created cvsps/.git, but no working copy.

That's because the remote side doesn't have a HEAD. Just run "git checkout --track -b master origin/master" to create a local branch the tracks the origin/master branch.

Dave.

#2 lore raw
Quoted 5 lines · David Symonds
Quoted 4 lines · Sergei Organov

Hello,

I've just cloned the public repo (it's rather small):

Quoted 7 lines
Quoted 3 lines
 $ git clone http://ydirson.free.fr/soft/git/cvsps.git

and it has created cvsps/.git, but no working copy.

That's because the remote side doesn't have a HEAD. Just run "git checkout --track -b master origin/master" to create a local branch the tracks the origin/master branch.

Thanks, that works:

$ git checkout --track -b master origin/master
warning: You appear to be on a branch yet to be born.
warning: Forcing checkout of origin/master.
Already on branch "master"
$

Couldn't GIT be more clever and just do this for me? Besides, the fact that it has created HEAD that points nowhere still seems wrong.

-- Sergei.