首先按幫助中的步驟下載repo工具:
[plain] view plain copy print?
curl?https://storage-googleapis.lug.ustc.edu.cn/git-repo-downloads/repo?> ~/bin/repo
此時查看下載下來的repo文件可以發(fā)現其中的REPO_URL已經指向中科大鏡像的地址,因此應該不需要修改:
[plain] view plain copy print?
REPO_URL = 'https://gerrit-googlesource.lug.ustc.edu.cn/git-repo'
接下來運行如下命令初始化倉庫
[plain] view plain copy print?
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest
發(fā)現沒有反應,很長時間后應該是超時才退出,報錯說無法訪問https://gerrit-googlesource.lug.ustc.edu.cn/git-repo/clone.bundle
把這個地址放到瀏覽器上嘗試發(fā)現也是超時無法訪問,最后好像還是指到google的官網去了,感覺應該是因為缺了什么東西,沒仔細研究。
但我發(fā)現中科大鏡像的Git-repo實際上是可以正常訪問的,因此最后使用如下方法:
1. 使用git clone命令直接從中科大鏡像下載repo工具:
[plain] view plain copy print?
git clone?https://gerrit-googlesource.lug.ustc.edu.cn/git-repo
git clone成功后可以在git-repo目錄下看到repo以及其他相關的腳本。
修改PATH環(huán)境變量將git-repo目錄加入PATH
2. 修改REPO_URL
此時查看git clone下來的repo文件可以發(fā)現其中的REPO_URL還是指向google官網的,因此需要修改該文件指向中科大鏡像:
[plain] view plain copy print?
REPO_URL = 'https://gerrit-googlesource.lug.ustc.edu.cn/git-repo'
3. 初始化倉庫
修改完repo文件后再運行repo init命令初始化倉庫就可以成功了:
[plain] view plain copy print?
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest
以后就可以使用repo sync命令同步源代碼了,速度很快。