Skip to contentSkip to conversation

Unable to clone empty repositories remotely

DISCUSSION Hannu Koivisto 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Greetings,

mkdir test
cd test
git init --bare --shared=group
cd ..
git clone test test2

works, though clone says it cannot checkout, which is expected. This is nevertheless very useful when you create a shared repository for a new project; you can then create a personal clone and start adding stuff to it. If, however, you normally work on another machine and want to have your personal clone there (i.e. git clone ssh://therepomachine/somewhere/test), cloning doesn't work at all (tested with git 1.6.0.3.525.ge32c2 in Cygwin):

Initialized empty Git repository in /cygdrive/c/temp/test/.git/
fatal: no matching remote head

This behaviour isn't documented by either git-init(1) or git-clone(1). I think it would be very convenient if this worked for the reasons mentioned above. I'm sure you could create your personal repository with git init and then git remote add the shared repository to it but that's much more difficult.

Signature · 1 line
Hannu
#1 lore raw
Quoted 25 lines · Hannu Koivisto

Greetings,

mkdir test
cd test
git init --bare --shared=group
cd ..
git clone test test2

works, though clone says it cannot checkout, which is expected. This is nevertheless very useful when you create a shared repository for a new project; you can then create a personal clone and start adding stuff to it. If, however, you normally work on another machine and want to have your personal clone there (i.e. git clone ssh://therepomachine/somewhere/test), cloning doesn't work at all (tested with git 1.6.0.3.525.ge32c2 in Cygwin):

Initialized empty Git repository in /cygdrive/c/temp/test/.git/
fatal: no matching remote head

This behaviour isn't documented by either git-init(1) or git-clone(1). I think it would be very convenient if this worked for the reasons mentioned above. I'm sure you could create your personal repository with git init and then git remote add the shared repository to it but that's much more difficult.

Quoted 8 lines

--
Hannu

--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

how about creating at least 1 empty commit before any cloning ?

wouldn't this solve the problem ?

Signature · 3 lines
Christian
--
http://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !
#2 lore raw
Quoted 35 lines · Christian MICHON
Quoted 25 lines · Hannu Koivisto

Greetings,

mkdir test
cd test
git init --bare --shared=group
cd ..
git clone test test2

works, though clone says it cannot checkout, which is expected. This is nevertheless very useful when you create a shared repository for a new project; you can then create a personal clone and start adding stuff to it. If, however, you normally work on another machine and want to have your personal clone there (i.e. git clone ssh://therepomachine/somewhere/test), cloning doesn't work at all (tested with git 1.6.0.3.525.ge32c2 in Cygwin):

Initialized empty Git repository in /cygdrive/c/temp/test/.git/
fatal: no matching remote head

This behaviour isn't documented by either git-init(1) or git-clone(1). I think it would be very convenient if this worked for the reasons mentioned above. I'm sure you could create your personal repository with git init and then git remote add the shared repository to it but that's much more difficult.

Quoted 8 lines

--
Hannu

--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 3 lines

how about creating at least 1 empty commit before any cloning ?

wouldn't this solve the problem ?

No, it wouldn't. I don't doubt that there are workarounds - I mentioned one possibility myself. Admittedly your workaround may be more convenient than mine, but it's still a workaround.

Now that I think of it, I wonder if one could go one step further in shared repository creation usability and make it possible to do that git init step remotely as well (I mean, directly with a one-step git command instead of ssh host "cd /repos ; mkdir foo ; cd foo; git init ..."). Since git init doesn't take non-option arguments, I suppose it could be extended to accept ssh (and file) urls for this purpose? And maybe an option to create a corresponding local clone at the same time.

Signature · 1 line
Hannu