Gitolite - Add New User2013/03/06 |
Add New User in Gitolite.
|
|
[1] | Create SSH keys with a User you'd like to add in Gitolite. |
[cent@www ~]$ ssh-keygen -t rsa -f ~/.ssh/id_cent Generating public/private rsa key pair. Enter passphrase (empty for no passphrase): # set passphrase Enter same passphrase again: # confirm Your identification has been saved in ./.ssh/id_cent. Your public key has been saved in ./.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@www.srv.world The key's randomart image is: |
[2] | Pass the SSH public key which a user cerated to Gitolite admin. Next, Add the user with Gitolite admin like follows. |
-sh-4.1$ cd ./gitolite-admin/keydir -sh-4.1$ git add id_cent.pub -sh-4.1$ git commit -m "Add User cent" -sh-4.1$ git push origin master Counting objects: 7, done. Delta compression using up to 2 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 708 bytes, done. Total 4 (delta 0), reused 0 (delta 0) |
[3] | Make sure if added user can do clone. |
[cent@www ~]$
vi ~/.ssh/config # create new host GitServer # any name you like user gitolite hostname 10.0.0.31 # Git server's hostname or IP address port 22 identityfile ~/.ssh/id_cent # specify private key chmod 600 ~/.ssh/config [cent@www ~]$ git config --global user.name "cent" [cent@www ~]$ git config --global user.email "cent@srv.world" [cent@www ~]$ git clone ssh://GitServer/testing Initialized empty Git repository in /home/cent/testing/.git/ warning: You appear to have cloned an empty repository. [cent@www ~]$ total 4 drwxr-xr-x 3 cent cent 4096 Mar 6 14:03 testing # just done
|