Tuesday, May 29, 2007

Publishing Git Repositories

Dear Lazyweb,

I've been using git for a while for most of my projects, and I love it. It's fast, powerful, and it's actually quite simple to use. Whenever I start hacking on something, even if it's just a little utility that will never see the light of day, I generally initialize a git repo and hack in there.

But my question is, what do I do if I want to make that repository public? I want to create a 'bare' repository (e.g. without any working directory files) on a public server that I can push to, and that others can pull from and push to. I would have expected some command like git clone --bare ./local-repo ssh://remote-server/remote-repo, but that doesn't seem to work. Am I overlooking something obvious?

anonymous: I intentionally reversed the last two arguments of 'git clone' because I want to initialize a public remote git repo from my local git repo. Reversing the arguments as you suggest only works if you want to clone a public git repo into a local git repo, which is the opposite of what I'm trying to do.

If you've got git on the remote machine, then you could replace the scp with a git-clone --bare pointing back at your local repository. The advantage being that it's a bare repository, and I guess you end up transferring less data.

Aha! So there *is* some official documentation on the subject. I had looked and looked but couldn't find anything about it. Thank you very much for that link. This lazyweb thing is pretty impressive :)