Once this worked for me, but for some reason it does not anymore and I don't know exactly why.
In the following I'll just write down the bare minimum steps to create a gitolite setup. This assumes that:
- you have a distribution of GNU/linux or *BSD on both - server system and client system
- you have git installed on the server and the client
- you can create a new user account for gitolite on the server system
- 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
andkelly.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
This assumes that the SSHd listens on port 22. If it uses another port, extend the GIT_SSH_COMMAND with
-p <PORTNUMBER>
- 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.