blino's website

Free software developer and more

Today, I have begun to set up an internal GIT repository, using the Git Repository Administration guide as reference.

So, let's create a /mnt/BIG/git repository on the (fictionnal) git.mandriva.com system, and restrict write access to members of the git group. This top directory has to be created with set-group ID, so that all users from the git group can add new objects.

urpmi git-core
useradd git -d /mnt/BIG/git
chmod +s /mnt/BIG/git

A projects/tests.git can be added this way (see the Git core tutorial for developers , Publishing your work section):

mkdir -p /mnt/BIG/git/projects/test.git
GIT_DIR=/mnt/BIG/git/projects/test.git git init-db
chmod -R g+w /mnt/BIG/git/projects/test.git

An interesting addition could be to pack the repository, as Samir informed me (see Git core tutorial for developers , Packing your repository section)

At this point, if a SSH server is available, users can clone the repository from a remote system, using the ssh:// protocol.

git clone ssh://git.mandriva.com/mnt/BIG/git/projects/test.git
echo "Test" > README
git add README
git-update-index README 
git commit -m "initial README import"

This commits to the local repository, not to the git.mandriva.com repository.

To push changes on git.mandriva.com, users need write access, by being in the git group:

usermod -G git -a blino

Then, from a remote system, they can push their local repository changes to the master:

git push

An optionnal git-daemon can be configured, to make the git:// protocol usable (read-only).

cat /etc/xinetd.d/git-daemon <<EOF
service git-daemon
{
        disable         = no
        socket_type     = stream
        wait            = no
        user            = nobody
        type            = UNLISTED
        protocol        = tcp
        log_on_failure  += USERID
        port            = 9418
        server          = /usr/bin/git-daemon
        server_args     = --inetd --syslog --export-all --base-path=/mnt/BIG/git
}
EOF
service xinetd reload

For basic usage, the Git introduction tutorial (mostly for end-users) is a good starting point.



Comments are closed for this story.

Trackbacks are closed for this story.

blosxom Optimised for standards.
Olivier Blin (2005)