GNU Scientific Library - News: Simple Git repository publication
Simple Git repository publication
Item posted by -Deleted Account- <bjg> on Sun 26 Oct 2008 08:52:22 PM UTC.
If you are working on changes to a project using Git, such as GSL, it can be useful to make your repository public rather than sending patches.
The usual way to export a git branch involves running git-daemon, webdav or having git installed on the web server. However, it is also possible to export your repository simply by copying the .git directory to a web server. There are some limitations---your whole repository is exported, not just a specific branch, and you must run git-update-server-info each time before copying the files.
Directory index pages need to be enabled the web server---when a git client accesses your repository over http it needs to get a list of the files in each directory. With Apache this requires
Options +Indexes
You can then copy your repository to the web server:
$ git-update-server-info
$ rsync -vazP .git/ remotehost:/var/www/myrepo
Run these commands each time you want to export the repository e.g. after making some changes and committing them. Note the trailing slash on .git/ to copy the contents of the directory, rather than the directory itself. Both commands are needed, you can put them together in a script or add the command git-update-server-info to .git/hooks/post-commit and make it executable.
The repository should now be accessible remotely over http:
$ git remote add bob http://remotehost/myrepo
$ get fetch -v bob
$ git diff bob/master
If you want to work against a remote repository you can copy it as usual to your local machine:
$ git clone git://git.savannah.gnu.org/gsl.git
but to save space it is also possible to make a shallow copy:
$ git clone --depth 1 git://git.savannah.gnu.org/gsl.git
The git documentation suggests that fetch will not work against a shallow copy, but it seems to work ok in this context.
dump transports (http), rsync, and packing (posted by Jason Riedy, Mon 27 Oct 2008 01:11:51 PM UTC) |
Packing your repository every so often is a good idea. Packs save a great deal of space. However, a dumb transport like http does not handle packs terribly efficiently. Also, a dumb push method like rsync needs a bit of help to handle packs while not stomping on clients.
|
RE: dump transports (http), rsync, and packing (posted by Jason Riedy, Mon 27 Oct 2008 01:13:19 PM UTC) |
Or you could just use one of the nice, free git hosts like repo.or.cz... The git hosts tend to handle multiple copies (forks) of the same repo very well. |
Powered by Savane 3.14-9aa3.
Corresponding source code