Trace: gitolite-setup

In the following I'll just write down the bare minimum steps to create a gitolite setup. This assumes that:

  1. you have a distribution of GNU/linux or *BSD on both - server system and client system
  2. you have git installed on the server and the client
  3. you can create a new user account for gitolite on the server system
  4. there is a running SSHd on the server system

On the workstation

  • create a new pair of ssh keys on your workstation - let's say kelly and kelly.pub

On the server system

  • Create a new useraccount on the server system - my one is called "git".
  • Give this useraccount a password.
  • Transfer the kelly.pub file into the git user's home directory - so that you have:
    /home/git/kelly.pub
  • Switch identity to your newly created account with "switch user":
su - git
  • create a bin folder in $HOME directory:
mkdir ~/bin
  • Extend $PATH with the git user's $HOME/bin folder if needed:
export PATH=$HOME/bin:$PATH

Check first your $PATH if this step is needed.

  • To make the PATH settings permanent integrate this into the git user's shell environment as needed.
    If you use bash then you might want to put the export command into the ~/.bashrc
  • Clone the gitolite repository:
git clone https://github.com/sitaramc/gitolite
  • Be sure to be in the root of the git user's home directory and install gitolite:
cd ~/
gitolite/install -ln
  • In case you didn't already: set git's default branch name to something other than the default
git config --global init.defaultBranch main
  • Now use the gitolite command to set up the ssh-key:
gitolite setup -pk kelly.pub

Back on the workstation

  • Clone the gitolite-admin repository:
GIT_SSH_COMMAND='ssh -i ~/.ssh/kelly' git clone git@exampleserver.tld:gitolite-admin

  • Configure the admin repository to alway use the key:
cd gitolite-admin
git config core.sshCommand 'ssh -i ~/.ssh/kelly'

And again: if the SSHd doesn't listen on stand port 22, configure it

cd gitolite-admin
git config core.sshCommand 'ssh -i ~/.ssh/kelly -p <PORTNUMBER>'

You might want to give the git user another shell than bash - something with less priviliges etc. More information about stuff like that will follow.

pub/tech/git/gitolite-setup.txt · Last modified: 2024/02/18 09:23