Gitolite: add users and multipe keys per user

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.

  1. 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
  2. Copy public key to where you have gitolite-admin rights
    • scp mfang@client:/home/mfang
    • should be the file created from the ssh-keygen command from Part 1
  3. On computer (client) with gitolite-admin rights
    • mfang@client~$ cp gitolite-admin/keydir/
    • mfang@client~$ cd gitolite-admin
    • mfang@client~/gitolite-admin $ git add keydir/
    • 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, (, home/, laptop/, 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.

This entry was posted in Git and tagged , , , , . Bookmark the permalink.

1 Response to Gitolite: add users and multipe keys per user

  1. gloriphobia says:

    Actually what is written below that link is really straightforward. If bob has three public keys, you can call them,, and then in the conf file you just write bob and then it will apply to all three keys.

Leave a Reply to gloriphobia Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s