rsync .git directory rsync .git directory git git

rsync .git directory


There are a few possibilities:

  • You can just rsync the .git repository (or even whole repository together with working directory), provided that you don't have any activity in repository during rsyncing (same disclaimer as for using rsync:// protocol).

  • You can clone or fetch using deprecated rsync protocol (where repository URL / location looks like this: "rsync://host.xz/path/to/repo.git/"). Note that this protocol is deprecated, because if there is any activity in repository, you can get corrupted clone (or fetch).

    Also, as I have heard, it didn't work correctly in the presence of packed refs since 2007, and nobody noticed till recently. It will (it did) disappear in Git 2.8.

  • Or you can create git bundle, rsync it or scp it on other machine, and then clone or fetch from bundle.


Yes, that is possible. IIRC, git uses a relative approach. So it's safe to sync it with another computer.


You can rsync without any problems, but if you have some remotes declared with hostnames which are local to the machine (i.e. stored in /etc/hosts only) then those obviously won't work.

However, is there some reason why you don't use git itself to sync the content?