28 JunInstall and setup gitolite

Tuesday, 28 June 2011 — 06:31

Just wanted to create a new post for future reference, that also might help some others. For latest version, you should look at gitolite’s github web page

You will have to create a new pair of public and private keys in case you don’t have any currently:

cd ~
ssh-keygen -v -t rsa -C username@hostname

Once you have them, from your own workstation:

copy your ~/.ssh/id_rsa.pub file to /tmp/username.pub on the server:

scp ~/.ssh/id_rsa.pub username@hostname:/tmp/username.pub

Now, from the server, as root:

git clone git://github.com/sitaramc/gitolite
cd gitolite
src/gl-system-install
# defaults to being the same as:
# src/gl-system-install /usr/local/bin /usr/local/share/gitolite/conf /usr/local/share/gitolite/hooks

# to upgrade gitolite, repeat the above commands.  Make sure you use the
# same arguments for the last command each time.

# create your "hosting user" if not already created
useradd git

su - git

# (now as git)
gl-setup /tmp/YourName.pub

Back to your workstation:

git clone git@server:gitolite-admin

repositories, as well as user’s permissions to repos, branches, tags and user actions are defined from file conf/gitolite.conf in this clone repository. You just need to edit this file from your workstations, and push the changes. The repos will be created automatically for you in the server under /repositories.

You can find all the information related to this file here

The file currently contains:

repo        gitolite-admin
            RW+     =   username

repo        testing
            RW+     =   @all

To add a new repo, you need to add this:

repo        reponame
            RW+     =   username

Add and push the changes. The reponame repo will be created:

git add -A
git ci -m "updated configuration"
git push

It’s time for creating/adding the project. If it’s a new project, create directory, add project and init the repository. If you already has this, skip to next instructions:

mkdir myproject
cd mypyroject
git init
# do some work, git add and commit files

Add your server as remote, and push changes

git remote add hostname git@hostname:reponame.git
git push hostname master

Finally, some valuable config changes:

git config branch.master.remote hostname
git config branch.master.merge refs/heads/master

Comentarios

Añade tu comentario




(textile habilitado)
Negrita: *Google*
Enlace: "google.com":http://www.google.com
Imagen: !http://ggomeze.com/images/avatar.png!

ó Cancelar