Feb
12
2009
So you create a git repository (repo) on your local machine (foo) and begin hacking away. Then, you want to push a backup copy of that repo to another box (bar). What’s the best way to do that? There are many ways to do it, but some ways are dangerous and some are just cumbersome.
Ideally, git would have an option to push that instructs it to initialize the remote repository and just do the right thing. I hope this is in our future, but for now we have to do some dancing around.
The canonical way is
bar:~/repo$ git clone --mirror local:repo
...
foo:~/repo$ git push bar:repo --mirror
but that’s not always feasible due to firewalls and nasty NATs.
Unwise methods include copying the working tree with rsync or scp, doing something like the above without --bare or --mirror (which implies --bare), and other methods that would have you pushing to a non-bare repository.
The best method I’ve found is this:
bar:~$ git --git-dir=repo init --bare
foo:~/repo$ git remote add --mirror bar bar:repo
foo:~/repo$ git push bar
...
We set up a bare repository on bar, then set up a “remote” for bar which automatically mirrors (you could do that with the canonical method described above too), so it sends the whole shebang. After that, we push as we normally would.
6 comments | tags: bare, clone, git, init, mirror, push, revision, revision control, rsync
Oct
6
2006
I just finished reading this article on Upstart, a replacement for init.
I’ve long been dissatisfied with the System V init scheme. I’ve looked at
file-rc,
runit (which is similar to
daemontools), and briefly at some others
that have popped up from time to time (I think I remember one that had to do
with purple cows, but my memory is hazy). None of them has really done anything
for me. file-rc is a nice concept taken not quite far enough (it’s almost as
much a pain editing that file format as dealing with symlinks), and it’s not an
init replacement in any case. runit/daemontools are very handy, and I use them,
but when I tried to replace init with runit I made short work of hosing my
startup system. As easy as it is to write run scripts, I do not want to write
one for each daemon that I do now or ever will install.
But upstart is very promising. Its coolness
factor is higher than any of the others, and it has an upgrade path. In fact,
Ubuntu will be using upstart in the upcoming release of Edgy Eft, and is
already in use in Ubuntu testing, completely replacing sysvinit. Kudos to the
Ubuntu folks for recognizing the need for something better and implementing it.
I hope that replacing sysvinit with upstart (in an apt-get sort of way) in
Debian becomes a reality soon. In any case, I’m going to give it a test on my
laptop when I get some spare time.
no comments | tags: init, linux, rc