Search This Blog

Monday, August 1, 2011

HowTo: Install gitolite (gitosis replacement) on Fedora

gitolite-tutorial - senawario
gitolite documentation

After working to get my old gitosis working again, I found that development had stopped, and gitolite is the new project, that is now gitolite3 on Fedora 17 - knowing this is the most valuable part of this Howto :)

Gitolite replacement for Gitosis, Gitolite3 is a replacment for Gitolite on Fedora 17. This does NOT cover migration from gitolite 2. We are going to set up gitolite3 with user gitolite.
# Fedora
yum -y install gitolite3 git-all teamgit cgit
 #Ubuntu
apt-get install gitolite3 cgit

# Optional, allow login to gitolite3 account. 
vipw
# Change gitolite shell to /bin/bash (FC 17 is /bin/sh, I prefer bash)
#gitolite:x:492:485:git repository hosting:/var/lib/gitolite:/bin/bash

# Fix up gitolite account for bash
su - gitolite
cp /etc/skel/.* .
# Fixes prompt for funny nis logins...
ln -s .bashrc .profile
# pick-a-password, or not and su - gitolite as root.
passwd
exit
# Set the admin account user account.
su - rfoos
# set up key, take the defaults or use the one you have.
ssh-keygen -t rsa
scp .ssh/id_rsa.pub gitolite@localhost:`whoami`.pub
exit

# Set up the admin repo
su - gitolite
# replace rfoos with `whowasi` :)
gitolite setup -pk rfoos.pub
exit

# Step 7: ADDING NEW USERS AND REPOS
# The tutorial is good, these commands are for reference.
# (add manifest.git for repo...a good start for new projects :) )
su - rfoos
# The admin database, add users and repos
git clone gitolite@localhost:gitolite-admin
cd gitolite-admin/
# Add new user public keys like this.
# cp /tmp/newuser.pub keydir/.
# Add a repo, give users permissions to repos.
vi conf/gitolite.conf
#repo    manifest
#        RW+     =   rfoos
#repo @all R = gitweb daemon

git add keydir conf
git commit -m 'Added repo manifest.git, no new users.'
# On a new git install, you will get a message to set up name and email.
git config --global user.name "Rick Foos"
git config --global user.email rickfoosusa-nospam@nospam-gmail.com
git commit --amend --reset-author
# The push will trigger gitolite to create any new repo's.
git push origin master
# remote: creating manifest...
# remote: Initialized empty Git repository in /var/lib/gitolite/repositories/manifest.git/
exit

# Start using the new repository.
su - rfoos
# List all repositories you have access to.
# ssh gitolite:localhost info -h
ssh gitolite:localhost info
git clone gitolite@localhost:manifest
# Bare repo, create the first file, put it on master branch.
cd manifest
echo "This repository contains repo manifests." > README
git add .
git commit -m 'initial project version'
git push origin master
# Gui interface.
echo "AVAHI_COMPAT_NOWARN=1" >>.bashrc
teamgit manifest
exit

# Set up cgit.

#
# The gitolite documentation.

http://gitolite.com/gitolite/gitolite.html


No comments:

Post a Comment