2013年1月3日星期四

Setup new gitolite user and repo

Setup new gitolite user 
#Create the user's public key
  • $ssh-keygen -t rsa (default output path ~/.ssh/id_rsa.pub, rename it to new_user.pub)
  • git config --global user.email "Email"
  • git config --global user.name "Your Name"

#Add the key to gitolite (gitolite recommends to use method 2)
  • Method 1 - server side (@git~)
    • copy new_user.pub to server's /home/git/publickeys
    • $gitolite setup -pk publickeys/new_user.pub

  • Method 2 - client side (a client which is already added to the git server, and have read rights to gitolite-admin)
    • $git clone git@git.actatekrd.com:gitolite-admin
    • $git add keydir/new_user.pub
    • $git commit -m 'add users: new_user'
    • $git push
#Remove a user
  • $git rm keydir/new_user.pub



Setting up a remote repository and doing an initial “push”
#Create the new repo directory 

ssh to git server (from a client which had NOT added key git server) 
$ssh git@git.actatekrd.com (password:git)

or direct run the below commands on git server
  • $cd /home/git/repositories
  • $mkdir my_project.git
  • $cd my_project.git
  • $git init --bare
  • $git update-server-info (If planning to serve via HTTP)
#Add access rights of the new repo to users
From a client which is already added to the git server and have read rights to gitolite-admin
  • git clone git@git.actatekrd.com:gitolite-admin
  • edit gitolite-admin/conf/gitolite.conf, add access rights of the new repo to users
#Initial push from client(From a client which has RW rights to the new repo)
  • cd my_project
  • git init
  • git add *
  • git commit -m "My initial commit message"
  • git remote add origin git@git.actatekrd.com:my_project.git
  • git push -u origin master
(Optional) can use 'git'  to replace 'git@git.actateked.com' in the future
create ‘config’ file under ~/.ssh
host git
user git
hostname git.actatekrd.com

沒有留言:

發佈留言