Using Git on Alioth

Creating a new public Git repository (for a new project)

Git repository on git.debian.org doesn't get created with a new project, you have to request it at the [https://alioth.debian.org/tracker/?group_id=1&atid=200001 Tracker: Support Requests].

<!> Note: Instead of registering a separate project(s) for packages, consider asking yourself to be added to [http://alioth.debian.org/projects/collab-maint/ Collab Maint project]; see [http://wiki.debian.org/CollaborativeMaintenance CollaborativeMaintenance] for more information. After the Alioth login name xxx or xxx-guest is registered to Collab Maint project, you can start hosting Git project immediately by logging into alioth.debian.org and creating git repository under /git/collab-maint/.

For separately registered projects, the git.debian.org admins will create a directory named /srv/git.debian.org/git/project-name owned by your project group. You need to initialize your repository yourself afterwards. Basically you have to do:

$ cd /git/<group>
$ umask 002
$ mkdir myrepo.git
$ cd myrepo.git
$ git --bare init --shared
$ vim description

Then you have to put some real content in that empty repository. Either git fetch/pull on git.debian.org or git push from a remote host to git.debian.org. See below for the Git URLs that you can use.

Accessing repositories

They are accessible by git using sftp, rsync over ssh, or git-server/http for read-only access. For instance, you'll be able to check out your branch though sftp with:

$ git clone ssh://<user>@git.debian.org/git/<group>/myrepo.git

Anonymous users will enjoy read-only access with:

$ git clone git://git.debian.org/git/<group>/myrepo.git
$ git clone http://git.debian.org/git/<group>/myrepo.git

Please use the native git protocol, because it is much more efficient than cloning over http. If your firewall restricts access to port 9418 you could clone over http. But notice that if the upstream repo on alioth is repacked, you have to download the whole objects again if you clone/fetch over http.

Repository maintenance

Git repositories tend to grow quite large quickly. From time to time, you have to repack the repositories to save space and keep optimal performances (by not having too many of files in the objects subdirectory).

$ cd /git/<group>/myrepo.git
$ git repack && git gc

Those operations should be always safe. You can optimize even more by using some options but then people fetching over HTTP (bad idea!) might have troubles:

$ git repack -a -d && git gc --prune

Setting up hooks

Commit mails with diff

Modify the relevants values in the log below:

$ cd myrepo.git
# For sending diff to a mailing list use this:
$ git config --add hooks.mailinglist "project-commit@lists.alioth.debian.org"
# For sending diff to the PTS use this:
$ git config --add hooks.bcc "package_cvs@packages.qa.debian.org"
# Create the hook
$ cat >hooks/post-receive <<END
#!/bin/sh
exec /usr/local/bin/git-commit-notice
END
$ chmod 755 hooks/post-receive

Sending notices on IRC via CIA bots

Some hooks meant for CIA are there: http://svn.navi.cx/misc/trunk/cia/htdocs/clients/git/

If you use the above git-commit-notice already, you can configure CIA simply by adding some variables:

$ cd myrepo.git
# Required to activate it
$ git config --add hooks.cia-project myproject
$ git config --add hooks.cia-use-rpc 1 # Only if you want to submit with XML RPC instead of mail
$ git config --add hooks.cia-rpc-uri http://cia.vc/RPC2 # Only to use another CIA server

Using personal Git repositories

It is also possible to have personal Git repositories. Just log in on alioth, then

$ mkdir ~/public_git

and put your Git repositories there, e.g. project1.git, project2.git, etc.

They will be available through the following URLs:

$ git clone git://git.debian.org/~$login/project1.git


?CategoryAlioth