Differences between revisions 32 and 33
Revision 32 as of 2008-02-29 12:06:13
Size: 4924
Editor: ?DamyanIvanov
Comment: patch -> path
Revision 33 as of 2008-02-29 12:06:54
Size: 4943
Editor: ?DamyanIvanov
Comment: add "git push --tags" to the push example
Deletions are marked like this. Additions are marked like this.
Line 38: Line 38:
$ git push --tags

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 using the [http://alioth.debian.org/projects/collab-maint/ Collab Maint project]; see ["Alioth/PackagingProject"] for more information. Once granted access to that project (DD have access by default, non-DD must request it) you can start hosting Git project immediately by logging into alioth.debian.org and creating a git repository under /git/collab-maint/.

For separately registered projects, the git.debian.org admins will create a directory named /git/<project-group> owned by your project group.

To initialize your remote repository, you have to run under /git/<group> (<group> can be collab-maint if you don't have a dedicated project):

$ umask 002
$ mkdir <project>.git
$ cd <project>.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.

<!> Example: To create local Git repository and populate it with existing source:

$ cd /path/to/sources/<project>
$ git init
$ git add .
$ git commit -m 'Initial import of <project> version <version>'
$ git tag <version>

<!> Example: To push a project to an alioth collab-maint repository:

$ cd /path/to/<project>.git
$ git remote add alioth ssh://<user>@git.debian.org/git/collab-maint/<project>.git
$ git push alioth <branchname>
$ git push --tags

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>/<project>.git

Anonymous users will enjoy read-only access with following commands. The <group> could be e.g. package name or collab-maint if hosted collaboratively.

$ git clone git://git.debian.org/git/<group>/<project>.git
$ git clone http://git.debian.org/git/<group>/<project>.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>/<project>.git
$ git repack && git gc

Those operations should be always safe (and can be ran via cron).

You can optimize even more by using some options but then people fetching over HTTP (bad idea!) might have troubles and they are not safe to run when someone else is using the repository (for example pushing new revisions). Thus don't put those commands in a cron invocation:

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

Setting up hooks

Commit mails with diff

Modify the relevants values in the log below:

$ cd <project>.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://cia-vc.googlecode.com/svn/trunk/cia/htdocs/clients/git/

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

$ cd <project>.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