Chinaunix首页 | 论坛 | 博客
  • 博客访问: 277901
  • 博文数量: 91
  • 博客积分: 1772
  • 博客等级: 上尉
  • 技术积分: 930
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-17 19:49
文章分类

全部博文(91)

文章存档

2012年(1)

2011年(36)

2010年(50)

2008年(4)

我的朋友

分类: LINUX

2010-12-06 14:01:40

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/tjd0227/archive/2010/06/01/5640480.aspx

1、安装git dameon
view plaincopy to clipboardprint?
$ sudo apt-get install git-daemon-run  

2、设置仓库目录
修改/etc/sv/git-daemon/run,配置git tree的目录以及共享目录
view plaincopy to clipboardprint?
$ vi etc/sv/git-daemon/run   
 
#!/bin/sh  
exec 2>&1  
echo 'git-daemon starting.'  
exec chpst -ugitdaemon \  
  /usr/lib/git-core/git-daemon --export-all --base-path=/pub/gittrees /pub/gittrees  
  
? --export-all:导出(共享)所有目录,否则要在每个要导出的目录下作如下操作:
view plaincopy to clipboardprint?
$ touch git-daemon-export-ok  

? --base-path: 映射仓库地址。/pub/gittrees是镜像目录。比如:
git://your_server_ip/ repository/platform/manifest.git,则仓库地址在
/pub/gittrees/ repository/platform/manifest.git


3、制作android服务器镜像

view plaincopy to clipboardprint?
$ mkdir  /pub/gittrees/android-mirror/  
$ chown git.git  /pub/gittrees/android-mirror/       
$ cd  /pub/gittrees/android-mirror/  
$ repo init -u git://android.git.kernel.org/platform/manifest.git --mirror  
$ repo sync  


这会花很长时间,为将来使用方便,需要耐心等待。
 
 4、建立自己软件团队的公用版本库
1、建立版本库
 
view plaincopy to clipboardprint?
$ mkdir  /pub/gittrees/our-repository  
$ cd  /pub/gittrees/our-repository  
  
$ repo init -u git://your-server-ip/android-mirror/platform/manifest.git --mirror  

修改.repo/manifest.xml
view plaincopy to clipboardprint?
-           fetch="git://android.git.kernel.org/"  
+           fetch="git://your-server-ip/android-mirror/"  
  
$ repo sync  

 
 
2、创建团队的master-2.1_r2开发分支
1、下载android-2.1_r2代码
view plaincopy to clipboardprint?
$ mkdir my-android-code  
$ cd my-android-code  
$ repo init -u git://your-server-ip/our-repository/platform/manifest.git –b android-2.1_r2  

 
按提示输入自己的用户名和邮箱即可
 修改.repo/manifest.xml
view plaincopy to clipboardprint?
-           fetch="git://android.git.kernel.org/"  
+           fetch="git://your-server-ip/our-repository/"   
  
$ repo sync  

 
等10分钟左右,代码下载完成。
 
2、下载完成后建立主干开发分支
view plaincopy to clipboardprint?
$ repo start master-2.1_r2 --all  

 
3、设置远程仓库的别名为my-korg
view plaincopy to clipboardprint?
$repo forall -c 'git remote add mykorg /pub/gittrees/our-repository/\   
           $REPO_PROJECT.git $@'  

 
注:删除myorg:
$ repo forall -c git remote rm myorg
 
4、将分支提交至公共版本仓库
view plaincopy to clipboardprint?
$ repo forall -c git push myorg master-2.1_r2:refs/heads/master-2.1_r2  
$ repo sync  

 
5、为你的公共版本库建立manifest分支
 
view plaincopy to clipboardprint?
$ cd my-android-code/.repo/manifests  
$ git checkout -b master-2.1_r2  
$ vi default.xml  

 
按如下方式修改
view plaincopy to clipboardprint?
 
  
-           fetch="git://android.git.kernel.org/"  
+           fetch="git://172.20.158.5/our-repository/"            review="review.source.android.com" />  
-  
+  
            remote="korg" />  

 
修改完成后提交并将branch提交至公共版本库
view plaincopy to clipboardprint?
$git commit -a  
$git remote add our-repository /pub/gittrees/your-repository/platform/manifest.git  
$git push your-repository master-2.1_r2:refs/heads/master-2.1_r2  

 
 
现在我们自己团队的公共版本库创建完成。
公共版本库的路径为:
/pub/gittrees/our-repository /
外部可访问仓库地址为:
git://your-server-ip/your-repository/platform/manifest.git
Repo访问方法:
view plaincopy to clipboardprint?
$repo init -u git://your-server-ip/our-repository/platform/manifest.git –b master-2.1_r2  


 
阅读(1451) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~