Publishing a single git branch
Scott, your blog seems to be down. Therefore this way:
# create target repository
GIT_DIR=/tmp/stuff git init --bare
# tell git about that new repository
git remote add stuff /tmp/stuff
# publish your branch
git push stuff some-branch:master
# verify that everything worked
git clone /tmp/stuff /tmp/check
For what ever reason "git clone" expects a master branch to exist in each repository. By renaming "some-branch" to "master" when pushing you make "git clone" happy.
Comments
Post a Comment
This site's webmaster failed misserably in upgrading the underlaying web framework.
The comment system is entirely broken right now. Sorry!
What does "bare" in this case mean?
git doc tell me just that it creates a "bare" repository....
and isn't the proposed "git clone . ssh://bla/bla" much easier? not sure whether that works, but Scott has it in his post iirc.
"git clone" can be satisfied by changing the branch referred to in HEAD in the remote repository to something other than master.
By default "git init --bare" generates a HEAD with "ref: refs/heads/master". If you push "some-branch" and change HEAD to refer to "some-branch" instead of "master", the clone should work properly
Scott's rant is a little over the top, but he's got a point. Especially when creating a _remote_ repository.
I don't think git push should just create the remote repository without confirmation (probably with a --create option or something like that), but it probably should be a single command to push an existing branch to a new remote bare repository, all set up to be served from gitweb.
I'm not entirely sure that the distinction between a bare and non-bare repository is worthwhile, either. It's just one more thing to have to understand, and it doesn't really have any big benefit other than making sure a user doesn't accidentally modify a working copy. To be honest, having a working copy in a remote repository would be nice, as it could make some interesting hooks more plausible (e.g., automatic ChangeLog updating without having to copy a pre-commit hook into each user's local repo).
Scott is way off in claiming that git is broken or misdesigned or what not. It wasn't originally _meant_ to be easy to use by a human (porcelains were thought to be the way to go), so really right now it's just a matter of finding the difficult actions (creating a remote repo) and just making them easy. Nothing about the git design forces it to be hard... it's just a matter of nobody having put in the (very little) effort to make it easy yet.
In the Git development there is this thing called "scratch your own itch". I like Git very much and have only minor complaints about it, but I hope that at some point these various blog rants get more constructive and the energy is directed towards actually fixing things. Send patches here: <git@vger.kernel.org>.
Or use this: http://www.gnome.org/~newren/eg/
publish: Publish a copy of the current repository on a remote machine
Usage:
eg publish [--bypass-modification-check] REMOTE_DIRECTORY
Description:
Publishes a copy of the current repository on a remote machine. [...]