Git服务器安装
Posted by devon on January 6th, 2009 filed in 源代码管理Git on Ubuntu Server
安装Git-Core:
1 2 3 4 | sudo apt-get update # 可选步骤 sudo apt-get dist-upgrade # 可选步骤 sudo apt-get install git-core |
因为要用到 Gitosis ,所有,需要安装python setuptools
1 | sudo apt-get install python-setuptools |
安装 Gitosis
1 2 3 4 5 6 | mkdir ~/src cd ~/src git clone git://eagain.net/gitosis cd gitosis sudo python setup.py install |
增加名为Git的用户
1 | sudo adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/git git |
上传公钥到USER用户的根目录下(如果没有,用 ssh-keygen -t rsa 生成)
1 2 3 | scp .ssh/id_rsa.pub USER@YOUR_SERVER: sudo -H -u git gitosis-init < /home/USER/id_rsa.pub sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update |
到这一步,基本上都安装好了,到本地进行测试:
1 | git clone git@YOUR_SERVER:gitosis-admin.git |
成功后,在本地将有一个gitosis-admin目录,里面有gitosis.conf,keydir。
为Rails项目配置git
打开gitosis.conf,增加一块内容,members为某个用户的公钥~/.ssh/id_rsa.pub中的名字(在该文件的最后在)
1 2 3 | [group myrailsapp] members = vince@urbanpuddle writable = myrailsapp |
然后,提交修改
1 2 | git commit -a -m "created a new repository" git push |
将本地代码提交到git中
1 2 | cd myrailsapp git init |
创建 .gitignore 文件,用于忽略某些不需要进行代码管理的内容
1 2 3 4 5 | .DS_Store log/*.log tmp/**/* config/database.yml db/*.sqlite3 |
提交代码
1 2 3 4 | git remote add origin git@YOUR_SERVER:myrailsapp.git git add . git commit -a -m "initial import" git push origin master:refs/heads/master |
接下来,可以增加成员的公钥到系统中了
1 2 3 4 | cd gitosis-admin cp ~/alice.pub keydir/ cp ~/bob.pub keydir/ git add keydir/alice.pub keydir/bob.pub |
修改gitosis.conf
1 2 3 4 | [group myteam] - members = jdoe + members = jdoe alice bob writable = free_monkey |
提交修改
1 2 | git commit -a -m "Granted Alice and Bob commit rights to FreeMonkey" git push |
其它成员就可以获取代码了
1 | git clone git@YOUR_SERVER:myrailsapp.git |
请参考 Hosting Git repositories, The Easy (and Secure) Way
原文请参考 : http://enjoyrails.com/wikis/Git安装
Related posts:
- Git详解(一) 我用git最开始是在github,每次提交代码以后,右上角的部分就会显示这些信息,类似于下面的: commit fa6f27b7de063c2f301b0e7148b5bd5e813faa98 tree 5e7a19c158b89fbc52a078771a833ee839727404 parent 76f31606376180ca88efa12be341dbb14fb06fdf 咋一看,这40位的乱码挺吓人的,但是你了解它的作用就不会被吓到了。 这是object name,是作为你每次提交的信息标识。这是用SHA1加密hash函数根据你的对象的内容算出来的。Git的一些优点:...
- Git一分钟教程 流程:取代码 → 每次工作前更新代码到最新版本 → 修改代码 → 提交代码到服务器 取代码及修改全局设置 设置用户名与邮箱 git...
- Git详解(二) Git中级用法: Ignoring files 项目里总会出现你不想跟踪的文件。当然这些文件你不对它们进行git add操作就行了,但是这样也很麻烦, 如果使用git add .命令和git commit -a命令呢?你能告诉git去忽略一些文件,我们只需要在我们工作目录顶级创建一个.gitignore文件就可以了。就像这样:...
Related posts brought to you by Yet Another Related Posts Plugin.
December 24th, 2010 at 7:49 AM
order cialis in canada online…
Buyno prescription…
December 31st, 2010 at 6:58 AM
avodart@in.usa” rel=”nofollow”>.…
Buyno prescription…
January 5th, 2011 at 4:56 AM
generic@Cialis.now” rel=”nofollow”>.…
Buynow…
January 9th, 2011 at 2:55 AM
dicyclomine@and.imodium” rel=”nofollow”>……
Buygeneric drugs…
January 22nd, 2011 at 5:23 AM
depakote@classification.now” rel=”nofollow”>..…
Buygeneric drugs…
February 5th, 2011 at 2:04 AM
e-code for zometa…
Buyit now…
February 7th, 2011 at 4:59 AM
cats zanaflex…
Buydrugs without prescription…
February 7th, 2011 at 10:04 PM
what is the generic drug for wellbutrin 150 sr…
Buyno prescription…
March 4th, 2011 at 8:58 AM
Zyrtec…
Buyit now…
March 5th, 2011 at 2:24 PM
zyprexa relprevv j-code…
Buygeneric drugs…
March 9th, 2011 at 10:50 PM
Zyprexa…
Buynow it…
March 11th, 2011 at 9:25 AM
Prozac…
Buygeneric meds…
March 29th, 2011 at 9:08 AM
Tylenol@Tylenol.Tylenol” rel=”nofollow”>……
Buygeneric meds…
March 29th, 2011 at 10:41 AM
Topamax@Topamax.Topamax” rel=”nofollow”>.…
Buyit now…
March 31st, 2011 at 2:05 PM
Cozaar@Cozaar.Cozaar” rel=”nofollow”>.…
Buynow it…
April 3rd, 2011 at 5:15 PM
.…
Buynow…
April 4th, 2011 at 1:30 AM
rhinocort@vs.beconase” rel=”nofollow”>.…
Buyno prescription…
April 4th, 2011 at 12:56 PM
can@cymbalta.cause.vaginal.itching.and.irritation” rel=”nofollow”>..…
Buydrugs without prescription…
April 4th, 2011 at 4:13 PM
advair@side.effects” rel=”nofollow”>.…
Buyit now…
April 4th, 2011 at 7:59 PM
.…
Buyno prescription…
April 5th, 2011 at 5:08 AM
long@term.prilosec.use” rel=”nofollow”>.…
Buygeneric drugs…
April 6th, 2011 at 9:56 AM
abilify@and.olanzapine” rel=”nofollow”>.…
Buyit now…
April 6th, 2011 at 12:05 PM
side@effects.of.dog.medication.famotidine.and.flagyl” rel=”nofollow”>……
Buygeneric drugs…
April 6th, 2011 at 2:32 PM
pediatric@dosage.of.prednisolone” rel=”nofollow”>……
Buyno prescription…
April 7th, 2011 at 5:57 PM
……
Buygeneric drugs…