Windows安裝gerrit工具方法

  1. 安裝Python,python版本最好選擇穩定版本,已驗證版本2.7.11 [python2.7.11以上版本自帶安裝了pip,能夠省略步驟4至步驟5]
  2. 安裝Python時,指定的安裝路徑不能含有空格(已知的Pip Bug)
  3. 安裝完Python後,須要將Python的安裝路徑添加到系統環境變量Path裏(Python安裝路徑如:C:\Python27)
  4. 下載get-pip.py文件,下載地址:https://bootstrap.pypa.io/get-pip.py
  5. 右鍵選擇打開"git bash",進入bash終端後,執行下面命令: python get-pip.py
  6. 安裝完Pip後,須要將Python的Scripts路徑添加到系統環境變量Path裏(Scripts安裝路徑如:C:\Python27\Scripts)
  7. 關閉打開的git bash終端,再從新打開一個新的git bash終端,執行下面命令安裝git-review: pip install git-review
  8. git-review安裝完成後,關閉git bash終端
  9. 在Linux下生成一對祕鑰(可使用已有的祕鑰),放在C:\Users\Administrator.ssh目錄下(請根據登陸windows用戶,來肯定存放的目錄) [步驟9可換成:在git bash終端執行ssh-keygen -t rsa -C "xxxxxx@yy.com" #建議填寫本身真實有效的郵箱地址]
  10. 將生成的公鑰信息添加到review.xxxx.com對應用戶的SSH Public Keys裏
  11. git clone測試倉庫,地址:git@git.xxxx.com:project/gerrit_sample.git
  12. 在git clone的gerrit_sample目錄下,打開git bash終端
  13. 在打開的git bash終端裏,將已經commit的文件,執行下面命令進行review: git review
  14. 第一次git review時,提示輸入用戶名,請輸入,而後等待提交完成
  15. 成功後,能夠在review.xxxxxx.com上看到review記錄

問題: 在window系統上初次執行git review 報錯,git 找不到gerrit遠程倉庫,須要執行 git remote add gerrit ssh://username@review.xxxxxx.com:29418/gerrit_sample.gitpython

錯誤信息: Could not connect to gerrit. Enter your gerrit username: Trying again with ssh://@review.xxxx.com:29418/gerrit_sample.git <traceback object at 0x0000000003128A48> We don't know where your gerrit is. Please manually create a remote named "gerrit" and try again. Could not connect to gerrit at ssh://@review.xxxxx.com:29418/gerrit_sample.git Traceback (most recent call last): File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main "main", fname, loader, pkg_name) File "c:\python27\lib\runpy.py", line 72, in run_code exec code in run_globals File "C:\Python27\Scripts\git-review.exe_main.py", line 9, in <module> File "c:\python27\lib\site-packages\git_review\cmd.py", line 1534, in main sys.exit(e.EXIT_CODE) AttributeError: 'GitReviewException' object has no attribute 'EXIT_CODE'git

相關文章
相關標籤/搜索