repo init


1.安裝git
  ubuntu上安裝  ~$ sudo apt-get install git
  源碼安裝見另外一篇博文。
  驗證版本如下:
  xu@xu-HP-ProBook-4330s:~$ git --version
  git version 1.9.1

2.安裝配置repo
參考http://blog.csdn.net/sunchaoenter/article/details/46342759?_t=t
1.下載 repo
git://aosp.tuna.tsinghua.edu.cn/git-repo.git/

2. 修改repo
google的地址
REPO_URL = 'https://gerrit.googlesource.com/git-repo'
改為清華大學的地址
REPO_URL = 'git://aosp.tuna.tsinghua.edu.cn/git-repo'

另外,若之前做過git init成功過,則在repo客戶端目錄中有.repo目錄。
如果不需要檢查repo更新,可以把REPO_URL指定為本地的.repo/repo目錄,或者把.repo拷貝到某個目錄再指定。
如1.23版的repo:
原來是
import os
REPO_URL = os.environ.get('REPO_URL', None)
if not REPO_URL:
  REPO_URL = 'https://gerrit.googlesource.com/git-repo'
REPO_REV = 'stable'

改為
import os
REPO_URL = os.environ.get('REPO_URL', None)
if not REPO_URL:
  REPO_URL = '/home/xu/work/repo/repo'
REPO_REV = 'default'

並且要准備好那個目錄

cp  -r .repo /home/xu/work/repo

由於google在國內不能直接訪問,如果不改此步的話,
repo init的時候會長時間不響應,然后報網絡鏈接錯誤,
提示https://gerrit.googlesource.com/git-repo/clone.bundle無法連接。

如果上述清華的不好使,嘗試下面這個:
https://gerrit-googlesource.proxy.ustclug.org/git-repo

3.下載 manifest
google 的地址
$ repo init -u https://android.googlesource.com/platform/manifest
改為清華大學的地址
$ repo init -u git://aosp.tuna.tsinghua.edu.cn/platform/manifest

4.同步源碼
還是和以前一樣
$ repo sync
 
5.替換已有的AOSP源代碼的remote
如果你之前已經通過某種途徑獲得了AOSP的源碼,但是你希望以后通過TUNA同步,只需要將.repo/manifest.xml中的
     
      fetch=".."
      review="https://android-review.googlesource.com/" />
改為下面的code即可:
     
      fetch="git://aosp.tuna.tsinghua.edu.cn/"
      review="https://android-review.googlesource.com/" />

這個方法也可以用來在同步Cyanogenmod代碼的時候從TUNA同步部分代碼


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM