# git clone through http bug?

3 messages from 2008-02-14 to 2008-02-14. Participants: Sergei Organov, David Symonds.
Thread: https://gitlist.dev/t/12105

## Sergei Organov, 2008-02-14 17:27

Subject: git clone through http bug?
Message-ID: <873arvv479.fsf@osv.gnss.ru>
URL: https://gitlist.dev/e/873arvv479.fsf%40osv.gnss.ru

```
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.

```

## David Symonds, 2008-02-14 17:36

Subject: Re: git clone through http bug?
Message-ID: <ee77f5c20802140936y28be9b39i59753af66e1a5e36@mail.gmail.com>
URL: https://gitlist.dev/e/ee77f5c20802140936y28be9b39i59753af66e1a5e36%40mail.gmail.com
In-Reply-To: <873arvv479.fsf@osv.gnss.ru>

```
On Thu, Feb 14, 2008 at 9:27 AM, Sergei Organov <osv@javad.com> wrote:
> 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.

```

## Sergei Organov, 2008-02-14 18:28

Subject: Re: git clone through http bug?
Message-ID: <87r6fftmtd.fsf@osv.gnss.ru>
URL: https://gitlist.dev/e/87r6fftmtd.fsf%40osv.gnss.ru
In-Reply-To: <ee77f5c20802140936y28be9b39i59753af66e1a5e36@mail.gmail.com>

```
"David Symonds" <dsymonds@gmail.com> writes:
> On Thu, Feb 14, 2008 at 9:27 AM, Sergei Organov <osv@javad.com> wrote:
>> 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.

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.

```
