Installing Gitosis Through apt-get (Ubuntu 11.10)
Getting packages:
sudo apt-get install git-core
sudo apt-get install gitosis
The apt-get command creates a user gitosis, and it’s home directory is in /srv/gitosis/
Generate your pub/private key for the machine you want connect to git with:
ssh-keygen -t rsa
Copy that key (only the pub key, meaning the .pub file) to the machine that gitosis will be running on, and place it somewhere gitosis will have access. People usually use the temp directory (/tmp/id_rsa.pub), but in this case I used my home directory.
Then run this command it **initialize **the gitosis instance.
sudo -H -u gitosis gitosis-init < ~/id_rsa.pub
You should see the following:
Initialized empty Git repository in /srv/gitosis/repositories/gitosis-admin.git/
Reinitialized existing Git repository in /srv/gitosis/repositories/gitosis-admin.git/
Then run this command from the machine that has the pub/private key that you used you initialize gitosis:
git clone gitosis@localhost:gitosis-admin.git
You should **replace **localhost with the domain name of the server you are running gitosis from.
You should see the following when cloning the repo:
Cloning into gitosis-admin...
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 5 (delta 0), reused 5 (delta 0)
Receiving objects: 100% (5/5), done.
Then all you need to do is edit the gitosis config file and push back to the server.
Here are the commands to push it to the server:
git add .
git commit -m 'added some repos'
git push
Editing the config file: [group gitosis-admin] - just make something up for your team writable - this is where you’ll put the names of your repos separated by spaces for that group members - this is who has access to the repos, the names here correspond to the key file names in the keydir, add more by putting a space between them
[repo myrepo] - adding meta data to the repo myrepo gitweb = yes/no - do you want it to display in gitweb? owner - who’s the so called owner of the repo? description - how would be describe this repo?