|
|
Repository ManagementGit repositories are stored in git.gromacs.org:/home/git/repositories. Access to them is controlled by gitosis. It provides a convenient, centralized way to add members and create groups with write access to different projects. It utilizes a single user, git in the current installation, to access all repositories, while different developers are authenticated by their public keys. There is no need to create a user account for each developer. The configuration files of gitosis reside as a ceparate git repository, gitosis-admin, on the same server. Modification of the settings is done by checking-out (cloning) the repository on your personal machine (or in your home directory on gromacs), modifying the files, and uploading (pushing) the changes back to the server. All administration of the repositories, including gitosis-admin, should be done remotely via git, by cloning a local copy and uploading the changes. Do not edit directly the files on the server. Gitosis-admin repositorypeter# git clone git@git.gromacs.org:gitosis-admin.git peter# cd gitosis-admin.git Peter has to be a member of a group with write permissions to the gitosis-admin.git repository. See below for details. The git-daemonPublic access to the repositories is granted by the git-daemon. Parameters passed to the daemon can be modified by editing /etc/sv/git-daemon/run and restarting the daemon: root@git.gromacs.org# cat /etc/sv/git-daemon/run #!/bin/sh exec 2>&1 echo 'git daemon starting.' exec chpst -ugitdaemon:git git daemon --verbose --base-path=/home/git/repositories --user-path=public_git root@git.gromacs.org# sv restart git-daemon "--base-path" specifies the location of the repositories, while an "--export-all" flag would give all git repositories public access. The daemon distinguishes between git repositories and regular directories. If you want to grant public access only to a selection of repositories, then remove the --export-all option of the daemon parameter, and create and empty file named git-daemon-export-ok in the said repositories, or, since we are using gitosis for administration, the correct way to do it is by adding the following to the gitosis.conf file: [repo gromacs] daemon = yes Here, gromacs is the name of the repository to which we want to grant public access. If this option is not passed, then the git-daemon-export-ok file will be removed after the gitosis-admin.git repository is updated again. Adding a new developer to existing repositorySimply put the public key of the developer in the keydir directory in gitosis-admin.git, and add his/her name to the list of group members. Tell git to add the new file for upload and commit the changes. For example, add Joe as a gromacs developer, i.e. give him write access to the gromacs.git repository: // Joe's key has to be named joe.pub peter@local:/home/peter/dev# cp /tmp/joe.pub keydir // Add Joe to the corresponding project group peter@local:/home/peter/dev/gitosis-admin.git# cat gitosis.conf [gitosis] [group gitosis-admin] writable = gitosis-admin members = peter [group gmx] members = peter joe writable = gromacs // Tell git we have created a new file for inclusion peter@local:/home/peter/dev/gitosis-admin.git# git add keydir/joe.pub // Commit the changes to the local repository (see the git documentation links below) peter@local:/home/peter/dev/gitosis-admin.git# git commit -a -m "Added Joe to the gromacs developers" Created commit 7513ce4: Added Joe 1 files changed, 1 insertions(+), 1 deletions(-) create mode 100644 keydir/joe.pub //Upload the changes to the remote peter@local:/home/peter/dev/gitosis-admin.git# git push Now Joe and Peter have write access to the gromacs.git repository, but only Peter can administer the gitosis-admin.git one. Note that in the configuration file gitosis.conf the names of the developers, peter and joe, should be the same as the names of their public keys, without the .pub extension. Also, the names of the repositories, for example gromacs, do not include the extension .git. Creating a new project repositoryAdd the name of the new repository to the "writable = ..." list of the developer groups (or make a new group). Note that the directory containing the project will be automatically created at a later point, after the first "push" (see below). For example, to start a new project MyProject, Peter who is a member of the gitosis-admin group, edits gitosis.conf and adds myproject as the name of the new project repository which both Peter and Joe can work with: peter@local:/home/peter/dev/gitosis-admin# cat gitosis.conf [gitosis] [group gitosis-admin] writable = gitosis-admin members = peter [group dev-src] members = peter joe writable = gromacs myproject // Commit the changes locally ... peter@local:/home/peter/dev/gitosis-admin# git commit -a -m "Added a MyProject repository." Created commit d2c3702: Added a MyProject repository. 1 files changed, 1 insertions(+), 1 deletions(-) // ... and then to the server peter@local:/home/peter/dev/gitosis-admin# git push Counting objects: 5, done. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 338 bytes, done. Total 3 (delta 1), reused 0 (delta 0) To git@git.gromacs.org:gitosis-admin.git 776b9f9..d2c3702 master -> master Even though Peter has created a new repository, at this point there is nothing to be found about it in git.gromacs.org:/home/git/repositories beacuse nothing has been "pushed" to it. To do that, Peter creates a new project directory for the MyProject project (or use an already existing structure, cvs-import etc.), does development work and uploads to the server: peter@local:/home/peter/dev$ mkdir myproject peter@local:/home/peter/dev$ cd myproject/ peter@local:/home/peter/dev/myproject$ git init Initialized empty Git repository in /home/rossen/Desktop/dev/myproject/.git/ peter@local:/home/peter/dev/myproject$ git remote add myproject git@git.gromacs.org:myproject.git peter@local:/home/peter/dev/myproject$ touch file1 peter@local:/home/peter/dev/myproject$ git add file1 // Commit to the local repository copy peter@local:/home/peter/dev/myproject$ git commit -a -m "Added new file1." Created initial commit c518b17: Added new file1. 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 file1 // Upload to the server peter@local:/home/peter/dev/myproject$ git push myproject master:refs/heads/master Initialized empty Git repository in /home/git/repositories/myproject.git/ Counting objects: 3, done. Writing objects: 100% (3/3), 223 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To git@git.gromacs.org:myproject.git * [new branch] master -> master Now the myproject.git directory is created on the server: root@git.gromacs.org:/home/git/repositories# ls myproject.git branches config description HEAD hooks info objects refs In order to give anonymous users read access to the new repository add the following to gitosis.conf and commit/push: [repo myproject] daemon = yes Renaming a repository
Deleting a repository
|