Repo建立本地仓库脚本

Repo脚本

$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo  
$ chmod a+x ~/bin/repo
这边应该还要将repo加到/usr/bin/下面

创建本地库的脚本

这边使用的我自己修改的过的repo,方便不能翻墙的朋友测试,不过用官方的repo也是可以的,需要手动修改下面一句代码。
附件地址
下载附件解包后,里面的clone.bundle,repo,sh脚本都要在同一级目录,不然会自动联网下载。

#!/bin/sh
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
curDir=`pwd`
mkdir reposerver
cd reposerver
serverDir=`pwd`
git init --bare manifest.git
git init --bare app1.git
git init --bare app2.git
cd ../
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
git clone reposerver/manifest.git
cd manifest
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<manifest>
    <remote name=\"reposerver\"  fetch=\"$serverDir\" review=\"review.source.android.com\" />
    <default revision=\"master\" remote=\"reposerver\" />
    <project path=\"app1\" name=\"app1\" />
    <project path=\"app2\" name=\"app2\" />
</manifest>" > default.xml
git add default.xml
git commit -am "add default.xml"
git push origin master:master
cd ..
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
git clone reposerver/app1.git
cd app1
echo "Hello world!" > hw1
git add hw1
git commit -am "add file"
git push origin master:master
cd ..
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
git clone reposerver/app2.git
cd app2
echo "Hello world!" > hw2
git add hw2
git commit -am "add file"
git push origin master:master
cd ..
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
mkdir repoclient
cd repoclient
cp ../clone.bundle ./
cp ../repo ./
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++use local repo
python ./repo init -u $curDir/reposerver/manifest.git
#repo init -u $curDir/reposerver/manifest.git
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
repo sync
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
repo info
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值