Re: New to git
From: Matthieu Moy <hidden>
Date: 2016-06-15 22:51:00
Marco Maggesi [off-list ref] writes:
Hi Chris and Peff, 2011/4/8 Jeff King [off-list ref]:quoted
But if you are just using the server as a distribution point for a single repository, it can be much simpler. For example, if you always just want to push and overwrite what is on the server (i.e., like a mirror), you can just use plain rsync outside of git. To avoid mirror lag, you do want to update the objects before the refs. So this: LOCAL=/path/to/repo.git REMOTE=server:path/to/repo.git rsync -a $LOCAL/objects/ $REMOTE/objects/ rsync -a $LOCAL $REMOTE would work. And then expose repo.git on the server via http or ftp, and clients can clone directly from it.this is the solution I was looking for (but I where not sure that it worked).
It works, but "git push" does something that rsync can't: it will refuse non-fast forward, i.e. refuse to override commits that you don't have locally. So, I'll just insist on the "if you are just using the server as a distribution point" part. If you ever push from two different machines to the server with rsync, you'll take the risk of loosing data. If the server runs an HTTP server, an alternative is to push over WebDAV, it doesn't require Git on the server. It's slow, but safer than rsync. -- Matthieu Moy http://www-verimag.imag.fr/~moy/