1. install
# run on server
$ sudo apt-get install git-core gitosis
2. generate ssh key
# run on your pc
$ ssh-keygen -t rsa
3. upload the ssh public key
# run on your pc
$ scp ~/.ssh/id_rsa.pub USER@YOUR_SERVER:/tmp
4. create admin repository
# run on server
$ sudo -H -u gitosis gitosis-init < /tmp/id_rsa.pub # monkey's ssh public key
$ sudo chmod 755 /srv/gitosis/repositories/gitosis-admin.git/hooks/post-update
5. checkout gitosis-admin
# run on your pc
$ git clone gitosis@YOUR_SERvER:gitosis-admin.git
6. grante right for members
# run on your pc, add new group - android
[group android] # team name
writable = 0xdroid-0x5 0xdroid-0x4 # project name
members = monkey@debian cow@ubuntu # members
# add cow's ssh public key
$ git add keydir/cow@ubuntu.pub gitosis.conf
# grante cow commit right to android
$ git commit -m "Granted cow commit right to android"
$ git push # now, cow has the commit right.
7. create new repositories
There are two ways to commit your code:
a. checkin your codes from zero
# create new repositories - 0xdroid-0x5.git
$ cd YOUR-CODE-DIR
$ mkdir 0xdroid-0x5.git && cd 0xdroid-0x5.git
$ git init
# modify .gitignore
$ git remote add origin gitosis@YOUR_SERVER:0xdroid-0x5.git
$ git add .
$ git commit -m "initial import"
$ git push origin master:refs/heads/master
b. checkin your codes from old git repo
$ cd YOUR-OlD-GiT-REPO
$ git remote -v
$ git pull # update
$ git remote rm origin
$ git remote add origin gitosis@YOUR_SERVER:0xdroid-0x5.git
$ git push origin master:refs/heads/master
8. checkout codes
$ git clone gitosis@YOUR_SERVER:0xdroid-0x5.git
No comments:
Post a Comment
您的评论将使我blog更有动力~