Figuring out why I was having trouble adding a user was pretty upsetting so I will share the experience and hope no one else runs into it also.
- Create the ssh key for user
- ssh-keygen -t rsa
- Do no try and use the -f option. I tried using the -f figuring it’d save me some time but using the -f prevents it from working correctly. stackoverflow
- Copy public key to where you have gitolite-admin rights
- scp id_rsa.pub mfang@client:/home/mfang
- id_rsa.pub should be the file created from the ssh-keygen command from Part 1
- On computer (client) with gitolite-admin rights
- mfang@client~$ cp id_rsa.pub gitolite-admin/keydir/mfang.pub
- mfang@client~$ cd gitolite-admin
- mfang@client~/gitolite-admin $ git add keydir/mfang.pub
- mfang@client~/gitolite-admin $ git commit -m ‘Add user “mfang”‘
- mfang@client~/gitolite-admin $ git push
Now say you use a laptop and a desktop both with usernames of mfang. How do you setup Gitolite to handle multiple keys for one user. There’s actually a recommendation in the documentation that of course you haven’t read.
The simplest and most understandable is to put their keys in different subdirectories, (alice.pub, home/alice.pub, laptop/alice.pub, etc).
I believe the point of doing it the above way is that in the conf/gitolite.conf file, it will recognize that user mfang is associated with all those keys.