Introduction and package installation
In this howto we'll not be covering the basic concept and usage of the Git VCS but just the installation procedure on Ubuntu 10.10.Let's start installing the needed packages:
sudo apt-get install git-core gitosis
Public key and initial configuration
To work with gitosis you need to setup a public key of a remote account that connects to the server via ssh to the server gitosis user.If you don't already have somewhere on the server the public key you need to generate it on your local machine:
ssh-keygen -t dsa
scp ~/.ssh/id_dsa.pub user@remotehost.example.com:
sudo -H -u gitosis gitosis-init < id_dsa.pub
Initialized empty Git repository in /srv/gitosis/repositories/gitosis-admin.git/ Reinitialized existing Git repository in /srv/gitosis/repositories/gitosis-admin.git/
Cloning the gitosis-admin and adding a new project
We can now clone the gitosis-admin repository to our local box:cd ~ git clone gitosis@remotehost.example.com:gitosis-admin.git
Inside the gitosis repository you'll find a folder called "keydir" with a copy of your inital imported key: you'll have to place all additional keys for additional users inside the directory with the ".pub" extensions.
We can now edit the configuration file to add users and projects:
nano gitosis.conf[gitosis]
#
# users (we made a group because every user could have more public keys for multiple PC)
#
[group user1]
members = user1@box1
[group user2]
members = user2@box1 user2@box2
#
# repository for gitosis (insert only administrative users)
#
[group gitosis-admin]
writable = gitosis-admin
members = @user1
#
# group of users to make up a team
#
[group team-name]
members = @user1 @user2
#
# first repository with a team working on it
#
[group projectname]
members = @team-name
writable = folder-name \
second-foldergit add . git commit -a -m "Added initial projects configurations" git push
Setting up repositories in a folder structure
If you want to setup a lot of repositories and want to subdivide them logically in a folder structure you'll to create those folder manually:sudo mkdir /srv/gitosis/repositories/project sudo chown gitosis.gitosis /srv/gitosis/repositories/project
First Push
Now that we have set up gitosis with the right keys and permission, let's create the first project by doing a first push from your local box:# move to the folder containing the project you want to insert on git cd testproject # this will create the project git init # add all the files git add . # do a local commit git commit -a -m "Initial import" # add the remote repository git remote add origin gitosis@remotehost.example.com:optional-folder/testproject.git # push everything to the remote server git push origin master
- Log in to post comments