repo服务器搭建



一.

pass

二.安装repo工具

curl http://android.git.kernel.org/repo > /user/local/bin/repo

chmod a+x /user/local/bin/repo

 

由于android.git.kernel.org连接不上,从其他地方获得了repo和repo文件夹

其中repo脚本中有

#REPO_URL='https://gerrit.googlesource.com/git-repo'

REPO_URL='ssh://git@192.168.211.131/repo/repo'

这里/repo/repo就是个仓库。

 

三.建立manifest工程

Server:

mkdir /repo/android_test

cd /repo/android_test

git init --bare manifest.git

 

sudo gedit /etc/sv/git-daemon/run

 Modify the last line to:

exec git-daemon --verbose --enable=receive-pack --export-all --base-path=/repo/

 Reboot the machine

Client:

git clone git@192.168.211.131:/repo/android_test/manifest.git

cd manifest

vi default.xml

git add --all

git commit -a -m "add default.xml"

git push --all

 

default.xml

<?xml version="1.0" encoding="UTF-8"?>

<manifest>

   

     <remote  name="openlinux"

              fetch="ssh://git@192.168.211.131/" review="" />

     <default revision="master"

              remote="openlinux"

              sync-j="1" />

   

    <project path="testproject" name="repo/android_test/testproject" />

 

</manifest>

注:

1.default revision="master"master是分支名,第一次建立默认是master,以后可以为repo start --all branchname 中指定的branchname。

2.<project path="testproject" name="repo/android_test/testproject" />

中path是本地下载后的目录,name是远程repo目录

 

四.建立实际工程

server:

建立空testproject工程

cd /repo/android_test

git init --bare testproject.git

Client:

初始化testproject工程:

git clone git@192.168.211.131:/repo/android_test/testproject.git

cd testproject

echo "this is testproject" > readme.txt

git add --all

git commit -a -m "add readme.txt

git push --all

 

 

五.测试

 

repo init -u ssh://git@192.168.211.131/repo/android_test/manifest.git

repo sync

 

git branch -r

m/master -> openlinux/master

openlinux/master

 

Bit branch -b 20131013

Git push openlinux 20131013

Git pull openlinux 20131013

 

 

=============================================================================

根据不同xml下载不同代码

Client:

git clone git@192.168.211.131:/repo/android_test/manifest.git

cd manifest

vi manifest_branch1.xml

git add --all

git commit -a -m "add manifest_branch1.xml"

git push --all

下载代码:

repo init -u ssh://git@192.168.211.131/repo/android_test/manifest.git

Repo init -m manifest_branch1.xml

repo sync

注:Repo init -m manifest_branch1.xml的作用是将.repo/manifest.xml链接到.repo/manifest/manifest_branch1.xml

 

 

Checkout

Repo checkout branchname//这里必须是本地分支,即repo start的分支

Git checkout branchname//这里可以是远程分支,也可是本地分支

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值