git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Possible to make a totally empty repository for remote access?
@ 2007-07-13 21:41 Wincent Colaiuta
  2007-07-13 22:18 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Wincent Colaiuta @ 2007-07-13 21:41 UTC (permalink / raw)
  To: git

For a new project (no code yet) I wanted to make an empty, bare  
repository (no working copy) on a remote public server as a starting  
point, clone it locally, and gradually create content locally and  
push it out to the remote, public server.

But so far I've been unable to do so in a straightfoward fashion...

mkdir test.git
cd test.git
git --bare init
touch git-daemon-export-ok

If I try to clone such an empty repository I get:

fatal: no matching remote head

And GIT_DIR/HEAD points to refs/heads/master, which doesn't exist yet.

Same if I go for a non-bare, but still empty repository:

mkdir test
cd test
git init
touch .git/git-daemon-export-ok

Only after adding actual content can I clone without getting the "no  
matching remote head" error:

echo "foo" > bar
git add bar
git commit -m "foobar"

Then cloning works.

I understand that Git is a *content* manager and a totally empty  
repository has no content, and therefore no tree object which the  
HEAD can point to. But the trouble with adding content the way I  
describe above, is that my public repository is no longer bare; it  
now has a working copy, which I didn't really want.

What's the way around this? Do I start with a non-bare repository,  
add any old bogus content, and then convert it to bare and blow away  
the working copy?

mkdir test
cd test
git init
touch .git/git-daemon-export-ok
touch .gitignore
git add .gitignore
git commit -m "Initial empty repository containing only an  
empty .gitignore file"
git config core.bare true
mv .git ../test.git
cd ..
rm -r test

Is there a better way? Am I missing something obvious?

Cheers,
Wincent

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-07-14 10:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-13 21:41 Possible to make a totally empty repository for remote access? Wincent Colaiuta
2007-07-13 22:18 ` Junio C Hamano
2007-07-14  2:19   ` Wincent Colaiuta
2007-07-14  2:58     ` Jeff King
2007-07-14  2:59       ` Jeff King
2007-07-14 10:26       ` martin f krafft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).