建本地 repo server

来源:互联网 发布:java集合框架中迭代器 编辑:程序博客网 时间:2024/05/21 17:22
首先 建立一个git server 参考前面的gentoo git server搭建过程
From: http://xxw8393.blog.163.com/blog/static/372568342011112111028926/

制作android服务器镜像

view plaincopy to clipboardprint?
  1. $ mkdir  /home/git/android/  
  2. $ chown nobody.nobody  /home/git/android/      
  3. $ cd  /home/git/android/ 
  4. $ repo init -u git://android.git.kernel.org/platform/manifest.git --mirror  
  5. $ repo sync  

 


建立版本库 
view plaincopy to clipboardprint?
  1. $ mkdir  /home/git/our-repository  
  2. $ cd  /home/git/our-repository  
  3.   
  4. $ repo init -u git://your-server-ip/android/platform/manifest.git --mirror  

修改.repo/manifest.xml

view plaincopy to clipboardprint?
  1. -           fetch="git://android.git.kernel.org/"  
  2. +           fetch="git://your-server-ip/android/"  
  3.   
  4. $ repo sync  

 

 

创建团队的master-2.1_r2开发分支

下载android-2.1_r2代码

view plaincopy to clipboardprint?
  1. $ mkdir my-android-code  
  2. $ cd my-android-code  
  3. $ repo init -u git://your-server-ip/our-repository/platform/manifest.git –b android-2.1_r2  

 

按提示输入自己的用户名和邮箱即可

 修改.repo/manifest.xml

view plaincopy to clipboardprint?
  1. -           fetch="git://android.git.kernel.org/"  
  2. +           fetch="git://your-server-ip/our-repository/"   
  3.   
  4. $ repo sync  

 

10分钟左右,代码下载完成。

 

2、下载完成后建立主干开发分支

view plaincopy to clipboardprint?
  1. $ repo start master-2.1_r2 --all  

 

3设置远程仓库的别名my-korg

view plaincopy to clipboardprint?
  1. $repo forall -c 'git remote add mykorg /pub/gittrees/our-repository/\   
  2.            $REPO_PROJECT.git $@'  

 

注:删除myorg

repo forall -c git remote rm myorg

 

4将分支提交至公共版本仓库

view plaincopy to clipboardprint?
  1. $ repo forall -c git push myorg master-2.1_r2:refs/heads/master-2.1_r2  
  2. $ repo sync  

 

 

 

    5、为你的公共版本库建立manifest分支

 

view plaincopy to clipboardprint?
  1. $ cd my-android-code/.repo/manifests  
  2. $ git checkout -b master-2.1_r2  
  3. $ vi default.xml  

 

按如下方式修改

view plaincopy to clipboardprint?
  1. <manifest>  
  2.    <remote  name="korg"  
  3. -           fetch="git://android.git.kernel.org/"  
  4. +           fetch="git://your-server-ip/our-repository/"            review="review.source.android.com" />  
  5. -  <default revision="refs/tags/android-2.1_r2"  
  6. +  <default revision="refs/heads/master-2.1_r2"  
  7.             remote="korg" />  

 

修改完成后提交将branch提交至公共版本库

view plaincopy to clipboardprint?
  1. $git commit -a  
  2. $git remote add our-repository /home/git/your-repository/platform/manifest.git  
  3. $git push your-repository master-2.1_r2:refs/heads/master-2.1_r2  

 

 

现在我们自己团队的公共版本库创建完成。

公共版本库的路径为:

/home/git/our-repository /

外部可访问仓库地址为:

git://your-server-ip/your-repository/platform/manifest.git

Repo访问方法:

view plaincopy to clipboardprint?
  1. $repo init -u git://your-server-ip/our-repository/platform/manifest.git –b master-2.1_r2  


0 0
原创粉丝点击