I'm installing gitolite from CentOS packages for my client. The package creates a gitolite user, which will be visible explicitly during a "git clone" operations. The client wants to use "git" and not "gitolite", in case we change to something more fancy later. I'm not very familiar with CentOS, so I don't want to try to build the package myself from source. I'm wondering if there's a way to do one of the following:

  1. Trick sshd into treating "git" as "gitolite".
  2. Somehow "alias" a new git username to be the same in all ways as the existing gitolite username (perhaps through some complex combinations of useradd).
  3. Rename the "gitolite" username to "git" without upsetting later yum update operations
  4. Something else that I hadn't thought of

I'd appreciate detailed instructions or pointers.

7 Answers 7


To add an 'aliased' user git for gitolite, you can do something similar to the following

[ec2-user@ip-10-170-94-162 ~]$ sudo useradd -m foo
[ec2-user@ip-10-170-94-162 ~]$ getent passwd foo
[ec2-user@ip-10-170-94-162 ~]$ sudo useradd -o -d/home/foo -u500 -g502 -s/bin/bash -M foo2
[ec2-user@ip-10-170-94-162 ~]$ getent passwd foo2

-o allows duplicate uids, -d sets the home directory, -u sets the uid, -g sets the gid, -s sets the shell, -M says don't create the home directory. I'm not sure how you would puppitize this, though.

  • # getent passwd gitolite (note uid, gid, home, shell) # useradd -o -d $HOME -u $UID -g $GID -s $SHELL -M git # getent passwd git (verify same as gitolite) ... works great! Oct 18, 2011 at 23:18

what you could try on client end, is edit the users ~/.ssh/config file and add some lines along the basis of this

Host yourservername.com
user gitolite

that way the just git clone as

git clone yourservername.com:path/to/git/repo.git

in future changes in username only require change in the ~/.ssh/config file locally on users machine

  • Yeah, that's the wrong end. It needs to work on the server side. Oct 18, 2011 at 22:02

Try #2.

Create a "git" user with the same UID, home directory, etc. as "gitolite". Not my favorite thing to do, but it should work.

I've done this before on Ubuntu boxes, and it works, but having multiple accounts share a single UID always seemed a bit "icky" to me.

  • And the commands to do that would be what? I'm not a linux guy. Just freebsd, openbsd, sunos, osx, Unix v7, 2.8BSD, 2.9BSD, 4.2BSD, etc etc. Never bothered learning Linux-GNU-isms. Oct 18, 2011 at 21:45

To do #1 you might try setting up a section in your ~/.ssh/config file.

Something like this:

host servername
     user gitolite
     hostname server.example.com
     port 22

Then you can do something like the following, and not have to mess with usernames.

git push servername

This is all assuming you're using OpenSSH as your ssh client.

  • Yeah, that's the wrong end. It needs to be something I can put in the server sshd. Or something else. Oct 18, 2011 at 22:02

I recently installed GitoLite and tried the package method. It was messy to be honest.

My second attempt was to create a standard user, then install manually following the non-root method instructions. Simpler and easier. I too wanted the "Git" username and used that.

So, my suggestion, remove the RPM install and follow the non-root method. :-)

(https://github.com/sitaramc/gitolite/blob/pu/doc/1-INSTALL.mkd for the instructions, but if you've cloned the repo you have that already)

  • This has to be easily deployable from puppet though. Using existing packages makes it much easier. Oct 18, 2011 at 22:03
  • Should be easy to deploy via puppet I would have thought. It's basically just create user, copy .pub files run the install script. Then management of GitoLite is managed via cloning that repo git@server:gitolite-admin editing settings and commit+push
    – LanceW
    Oct 18, 2011 at 22:04
  • There is also a way of getting Gitolite to use users user names and passwords. This would hide the gitolite@server account from users. colonelpanic.net/2011/03/… is an example and there is another (somewhere) which explains it another way.
    – LanceW
    Oct 18, 2011 at 22:14

If you're using key based auth in sshd, you can add a forced command in the authorized_keys file to sudo as the target user.

Add NOPASSWD in sudoers to stop double prompts.

Requires sudo and a puppet controlled git user.


When you use the "root" method of install, you're supposed to be able to run gl-system-install as root, and then run gl-setup as any user (and in fact any number of users) so that they can all be gitolite "hosting users".

I can't imagine the RPM would take away or somehow disable that inherent feature.

So my answer would be: dont bother with UIDs etc. Just install the RPM, add user 'git', su - git, then gl-setup yourname.pub. Should do it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .