repo學習筆記
安裝流程
1安裝Git
2安裝python3
3安裝repo
3.1下載repo
打開git base執行以下代碼
mkdir ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+rx ~/bin/repo
把C:\Users\你的用戶名\bin添加到環境變量
3.1下載repo工具源代碼(不確定是不是必要步驟,待驗證)
# 先隨便新建項目目錄,在項目目錄下
mkdir -p ./.repo
cd ./.repo
# clone工具集
git clone https://gerrit.googlesource.com/git-repo
# 一定要改文件夾名
mv git-repo repo
# 回到項目目錄
cd ..
4初始化manifest
4.1代碼庫新建manifest項目
4.2新建default.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="repoTest"
alias="origin"
fetch="https://github.com/" />
<project path="xyrxizhi/mytestgit" name="xyrxizhi/mytestgit" groups="null" revision="master" remote="repoTest"/>
<!-- ... -->
</manifest>
每個屬性代表的含義占坑
4.3初始化manifest
在項目本地地址執行gitbash
repo init -u 你的manifest項目鏈接
# 比如android的項目
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-10.0.0_r25
#--worktree好像是谷歌支持的后綴可以解決找不到worktree問題,但是這樣克隆下來好像沒有history
#--no-repo-verify不驗證 repo 的源碼,有history
#-b 選擇manifest的分支,默認master。也可以init后切換分支
下載遠端代碼
repo sync //-j4多線程下載
參考文獻
https://juejin.im/post/6844903718316408840
https://juejin.im/post/6844904057421742094