A project is often stored on several hosting services like Gitorious, GitHub, repo.or.cz or similar for backup purposes. Ideally, all these repositories should be updated at the same time when pushing. If you’re using a slow Internet connection, like a mobile connection from a laptop, this process tends to be rather slow because the commits have to be pushed several times over a slow connection. Gitspread aims to solve this by pushing the commits once to a server with a fast connection, and pushing the commits to all the remotes from that server.
- Create a directory called
- Create a bare repository for each project under that directory:
git init --bare $HOME/Git-spread/project.git
- Copy the
post-receivehook script to the
hooks/directory in the repository:
cp -p post-receive $HOME/Git-spread/project.git/hooks/
- or manually insert the code if
- Define all necessary remotes using SSH push URLs, for example:
git remote add gitorious firstname.lastname@example.org:foo/project.git
git remote add github email@example.com:user/project.git
- Start the
gitspreadddaemon in a shell where
- Set up a git remote on the local computer which has a slow connection:
git remote add spread firstname.lastname@example.org:/home/user/Git-spread/project.git
That’s all there is. From now on, you can push to the "spread" remote and let the remote server with a faster connection take care of spreading the commits around.
To stop the daemon, create a file named
stop in the top directory.
When the file is gone, the process is terminated. The PID of the current
process is stored in a file named
pid. This file is also deleted when
the process terminates properly.
If you don’t want to use
$HOME/Git-spread as the location for the
repositories, either set the
$GITSPREAD_REPODIR environment variable
to the preferred directory, or change the value of
post-receive and run
gitspreadd with the
The gitspreadd daemon chooses the directory this way:
Use the location specified by the
--repodir command line option,
$GITSPREAD_REPODIR if defined, otherwise use hardcoded
The following option can be used in the bare repositories:
- If "true", use
--force) option when pushing to the remote repositories. This allows gitspreadd to push non-fast-forward branches. Use with care. Valid values: "", "false" or "true".
- If "true", use
Gitspread can be cloned from the following repositories:
master branch is considered stable and will never be rebased.
Every new functionality or bug fix is created on topic branches which
may be rebased now and then. All tests on
master (executed with "make
test") should succeed. If any test fails, it’s considered a bug and
should be reported in the issue tracker.
Bugs and suggestions can be filed in the issue tracker at https://github.com/sunny256/gitspread/issues .
Author: Øyvind A. Holm email@example.com
License: GNU General Public License version 3 or later
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
vim: set ft=markdown tw=72 fenc=utf8 et ts=2 sw=2 sts=2 fo=tcqw :