Adding users to Gitolite

21,223

Solution 1

Here's the workflow for adding users to gitolite:

Add the users public key to the map keys as <username>.pub

Edit your gitolite config file (gitolite.conf), this file is in the map conf. When you open it, everthing will be clear.

example:

repo  someproject

  RW+ = darhuuk

  RW  = raphaelcruzeiro

  R   = santaclaus

Commit the new key and the modified config file. Then push it to your gitolite server.

That should do it!

[Edit] BTW, here is the gitolite paragraph that explains what I wrote above: http://gitolite.com/gitolite/conf.html.

Solution 2

Note that the recent gitolite v3.5.2-10-g437b497 introduces (September 2013, commit 59c817d0):

ukm, for "user key management".

User key management allows certain users to add and remove keys.

It introduces a level of delegation, when not just the gitolite admin user can add new ssh public keys, but other users can now do so as well.

You can see it in action in "contrib/t/ukm.t":

You need to enable that feature:

# enable user key management in a simple form.
# Guest key managers can add keyids looking like email addresses, but
# cannot add emails containing example.com or hemmecke.org.
system("sed -i \"s/.*ENABLE =>.*/'UKM_CONFIG'=>{'FORBIDDEN_GUEST_PATTERN'=>'example.com|hemmecke.org'}, ENABLE => ['ukm',/\" $h/.gitolite.rc");
Share:
21,223
Raphael
Author by

Raphael

I've been programming professionally for the past 9 years. Currently, my speciality is iOS development (though I still dwell in the backend world from time to time using Node or Python). I've been using Swift since it was first released in 2014 and the app that I've worked on for the past 3 years (Hole19) has been consistently rated 5 stars, with 99% of crash-free users and it was often featured on the App Store. On behalf of Hole19, I have attended WWDC 2016 in San Francisco. Before working on Hole19, I worked on a few consulting agencies and had extensive freelancing experience. Over the years, I have developed several mobile and web apps both big and small.

Updated on April 10, 2020

Comments

  • Raphael
    Raphael about 4 years

    I'm trying to setup Gitolite but I'm running into a weird issue:

    When I add a new public key file for a new user (say raphaelcruzeiro.pub), giolite sends me the following warning on push:

    remote: 
    remote:         ***** WARNING *****
    remote:         the following users (pubkey files in parens) do not appear in the config file:
    remote: raphaelcruzeiro(raphaelcruzeiro.pub)
    

    And when I try to clone a repository with this user, I get a permission denied:

    Cloning into gitolite-admin...
    R access for gitolite-admin DENIED to raphaelcruzeiro
    fatal: The remote end hung up unexpectedly
    

    Am I missing something here? Where and how do I add the user to the configuration file?

    Unfortunately Gitolite's documentation is rather vague on this matter.

  • Cascabel
    Cascabel about 13 years
    If you expect all users to be able to work with a given repository, you can use @all - but that's not a very good idea for your admin repo, generally. You want to add access to that on a case-by-case basis.
  • Raphael
    Raphael about 13 years
    Thank you. Now I realized that what I was trying to do what conceptually wrong and that gitolite is easier than I thought it would be. (I'm still having nightmares about my previous experience trying to setup gitosis)
  • holms
    holms over 11 years
    About that official manual link - there's no even a word about gitolite.conf, and I totally don't understand how the hell to add or extracts keys from gitolite installation...
  • MoonCactus
    MoonCactus about 7 years
    BTW the link is dead
  • AVH
    AVH about 7 years
    @MoonCactus Thanks for the notification. Link fixed.