|The instructions provided in this article or section are considered advanced.|
You are expected to be knowledgeable in the UNIX shell.
Git with Gitolit
Git does not come with any access control out of the box. If you know a URL for a git repository, you can clone and commit to it. Gitolite serves to fill in this gap and provide fine grained access control to git repositories.
This guide assumes that you are using a recent version of linux.
Before you begin you will need the following:
- A user account on Dreamhost dedicated to gitolite.
- This account will be used to access the git repo and nothing else
- After installation you will NOT be able to log in normally for this account. Either log in under a different account and the su, or run ssh with the "-o PubkeyAuthentication=no" or "-o preferredauthentications=password" option.
- SSH installed on your local machine
- SSH keys generated for your local machine
- See SSH for more information
- NOTE: Do NOT add your RSA public key to .ssh/authorized_keys on the server. Use a password to log in. Adding the public key will break things. Just trust us on this.
Below is an overview of these directions.
- Copy your public key to the server as "git-admin-name.pub". The name chosen here can be anything, but it will be the name of your git admin.
- Log into the server.
- Ensure that $HOME/bin is in your path. If it isn't, fiddle with the appropriate rc file for your shell to add it. This snippit will take care of it in bash:
echo "export PATH=$HOME/bin:$PATH" >> .bashrc; source .bashrc
- Run the following commands, replacing git-admin-name.pub with path of your copied public key file:
cd $HOME git clone git://github.com/sitaramc/gitolite gitolite/install -ln gitolite setup -pk git-admin-name.pub
Gitolite is now installed. You can remove the git-admin-name.pub file if desired.
Gitolite administration is NEVER done on the server itself. It is done by cloning the special gitolite-admin repo, making changes, and pushing the changes back to the server.
To clone the gitolite-admin repo:
git clone firstname.lastname@example.org:gitolite-admin
- Obtain public keys from each user.
- Rename each received key file to the name of the user, with a ".pub" at the end.
- Copy it into keydir/ in the gitolite-admin repo you cloned.
- Commit and push the repo:
git add keydir git commit git push
You do NOT need to add users as real (Unix) users. You do NOT add their keys directly anywhere on the server; you do it by cloning, adding keys, and pushing.
- Edit conf/gitolite.conf in the gitolite-admin repo.
- Add repo paragraphs (example below) and save the file.
- Commit and push the gitolite-admin repo
git add conf/gitolite.conf git commit git push
You do NOT add the repos directly anywhere on the server; you do it by cloning, adding keys, and pushing.
Example repo paragraph:
repo foo RW+ = alice RW = bob
- Gitosis (NOTE: this project is no longer undergoing maintenance)
- Gitorious (Local Install)
- Gitorious (Hosted)