Git

From wiki.vincentkong.com
Jump to: navigation, search

Contents

Installing Git on Ubuntu

$ apt-get install git-core

Getting Git on a Server

Setting up SSH

Create Git user to manage repositories on the server.

$ sudo useradd -d /home/git -m git

Generating your SSH public key on the client computer.

$ ssh-keygen 

The public key will be generated in $HOME/.ssh/id_rsa.pub.

Installing Gitosis

Gitosis requires some Python tools, so first you have to install the Python setuptools package.

$ apt-get install python-setuptools

Install Gitosis from the project’s main site.

$ git clone git://eagain.net/gitosis.git
$ cd gitosis
$ sudo python setup.py install

Copy the id_rsa.pub file to the Git server, and initialize Gitosis.

$ sudo -H -u git gitosis-init < /tmp/id_rsa.pub

Set the execute bit on the post-update script for your new control repository.

$ sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update

On the client/local computer clone the Gitosis control repository.

$ git clone git@gitserver:gitosis-admin.git

This will create a directory named gitosis-admin, which has two major parts:

$ cd gitosis-admin
$ ls
./gitosis.conf
./keydir

The gitosis.conf file is the control file you use to specify users, repositories, and permissions. The keydir directory is where you store the public keys of all the users who have any sort of access to your repositories — one file per user.

Adding a new project

Create new section called myteam where you’ll list the developers on the myteam team and projects that those developers need access to.

$ nano gitosis.conf

[group myteam]
writable = myproject1 myproject2
members = developer1 developer2

Whenever you make changes to the gitosis-admin project, you have to commit the changes and push them back up to the server in order for them to take effect

$ git commit -am 'add new projects and groups'
$ git push

References

Retrieved from "/wiki/Git"
Personal tools
MY WEBSITES