Centos – aliasing “git” ssh login to “gitolite”

centosgitgitolitessh

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.

Best Answer

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
 foo:x:500:502::/home/foo:/bin/bash
[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
 foo2:x:500:502::/home/foo:/bin/bash

-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.