InDefero

Sign in or create your account | Project List | Help

InDefero Commit Details

Date:2009-01-20 11:24:38 (1 year 2 months ago)
Author:Loïc d'Anterroches
Commit:1327e5f1e35bc07e4e84c0fc5843f2b0597077b8
Message:Added the documentation for the git synchronization.

Files: doc/syncgit.mdtext (1 diff)

Change Details

doc/syncgit.mdtext
1# Plugin SyncGit by Céondo Ltd
2
3The SyncGit plugin allow the direct creation and synchronisation of
4git repositories with the InDefero database. This requires giving
5access to the repositories using a dedicated SSH account, usually the
6`git` account.
7
8## Prerequisites
9
10A good understanding of:
11
12* the security issues related to using a SSH account on a server;
13* the principle of public/private SSH keys;
14* the rights/ownership of files on a Linux/BSD/nix system;
15
16Yes, what you are going to do has security implications.
17
18## Git user configuration
19
20On your system, you will need to create a new `git` account. This
21account will only be used to access the git repositories and at the
22moment cannot be shared for other use.
23
24First create a new git account:
25
26    $ sudo adduser \
27          --system \
28          --shell /bin/sh \
29          --gecos 'git version control' \
30          --group \
31          --disabled-password \
32          --home /home/git \
33          git
34
35Then, we need to create the base SSH files with the right permissions:
36
37    $ sudo su git
38    $ mkdir /home/git/.ssh
39    $ touch /home/git/.ssh/authorized_keys
40    $ chmod 0700 /home/git/.ssh
41    $ chmod 0600 /home/git/.ssh/authorized_keys
42    $ exit
43
44## Creation of the repositories base
45
46For each project using git in InDefero a corresponding bare repository
47will be created in `/home/git/repositories`. For example, if the
48shortname of your project is `wonder`, it will be created in
49`/home/git/repositories/wonder.git`
50
51    $ sudo -H -u git mkdir /home/git/repositories
52
53## InDefero Configuration
54
55First, you need to have python installed on your system to be able to
56run the very small python script `gitserve.py` in the `scripts`
57folder. Here is a configuration example:
58
59
60    $cfg['git_repositories'] = '/home/git/repositories/%s.git';
61    $cfg['git_remote_url'] = 'git://yourdomain.com/%s.git';
62    $cfg['idf_plugin_syncgit_path_gitserve'] = '/home/www/indefero/scripts/gitserve.py'; # yes .py
63    $cfg['idf_plugin_syncgit_path_authorized_keys'] = '/home/git/.ssh/authorized_keys';
64    $cfg['idf_plugin_syncgit_sync_file'] = '/tmp/SYNC-GIT';
65
66When someone will change his SSH key or add a new one, the
67`/tmp/SYNC-GIT` file will be created. The cron job
68`/home/www/indefero/scripts/gitcron.php` will see the file and update
69the content of the `authorized_keys` file.
70
71## Cron Job Configuration
72
73You need to run a cron job every now and then to synchronize the SSH
74keys. The command to run in the cron job is:
75
76    php /home/www/indefero/scripts/gitcron.php
77
78The user of the cron job must be `git`.

Archive Download the corresponding diff file

Branches:
dev
master
newdiff
svn