CentOS 7
Ads

Gitolite3 : Add Users
2015/07/21
 
Add New User in Gitolite.
[1] Login as a user which you'd like to setup for Gitolite and generate SSH key pair.
[cent@dlp ~]$
ssh-keygen -f ~/.ssh/id_cent

Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/cent/.ssh/id_cent.
Your public key has been saved in /home/cent/.ssh/id_cent.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx cent@dlp.srv.world
The key's randomart image is:
[2] Pass the SSH public key which is generated above to Gitolite admin user.
Next, Add the user with Gitolite admin like follows.
-sh-4.2$
whoami

gitolite3
-sh-4.2$
cd ~/gitolite-admin/keydir

-sh-4.2$
git add id_cent.pub

-sh-4.2$
git commit -m "Add User cent"

1 file changed, 1 insertion(+)
create mode 100644 keydir/id_cent.pub
-sh-4.2$
git push origin master

Enter passphrase for key '/var/lib/gitolite3/.ssh/gitadmin':
Counting objects: 6, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 686 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To ssh://GitServer/gitolite-admin
  1d61702..8d46625 master -> master
[3] Confirm to clone a repository with the user just added.
[cent@dlp ~]$
vi ~/.ssh/config
# create new

# any name you like

host GitServer
    user gitolite3
   
# Git server's hostname or IP address

    hostname 10.0.0.30
    port 22
   
# secret key

    identityfile ~/.ssh/id_cent
[cent@dlp ~]$
chmod 600 ~/.ssh/config

[cent@dlp ~]$
git config --global user.name "cent"

[cent@dlp ~]$
git config --global user.email "cent@srv.world"

[cent@dlp ~]$
git clone ssh://GitServer/testing

Cloning into 'testing'...
warning: You appear to have cloned an empty repository.
[cent@dlp ~]$
total 0
drwxrwxr-x 3 cent cent 17 Jul 21 20:50 testing
 
Tweet