# Gerrit和Jenkins使用手冊
登陸Gerrit
點選-->登陸Gerrit
使用者名稱:姓名全拼
密碼:姓名全拼
配置SSH公鑰
生成ssh

配置SSH私鑰
設定 ~/.ssh/config
>> vim ~/.ssh/config
Host 10.0.0.4:
IdentityFile ~/.ssh/id_rsa
PreferredAuthentications publickey
複製程式碼
設定 ~/.ssh/known_hosts
>> sh -c "ssh-keyscan -t rsa 10.0.0.4 >> ~/.ssh/known_hosts"
>> sh -c "ssh-keygen -H -f ~/.ssh/known_hosts"
==================注意==================
上面設定的~/.ssh/config檔案的許可權已定要設定成600
不然會報錯:“Bad owner or permissions on .ssh/config“
複製程式碼
找開發專案

克隆專案

程式碼提交
注意:使用git-review提交程式碼,沒有安裝git-review的,自行安裝
>> git pull --rebase // 和最新的倉庫進行一次同步,有衝突解決衝突(最後走 git commit --amend 命令),沒衝突繼續。
>> git review BXHLY
BXHLY 是所要提交的分支名稱
複製程式碼
登陸Jenkins,編譯專案
點選 Query and Trigger Gerrit Patches

1.點選 Search
2.選擇 和自己相關的提交記錄
3.點選 Trigger Selected

~~~~喝喝茶~,等待執行結果~


執行結果有錯誤

檢視錯誤日誌

注意:當稽核未通過打回時,我們再修改完成之後,執行:
git add 檔名
git commit --amend ##注意會保留上次的 change-id ,不會生成新的評審任務編號,重用原有的任務編號,將該提交轉換為老評審任務的新補丁集
git review BHXLY
複製程式碼
重新執行Jenkins上的任務

CodeReview

程式碼指定他人稽核

程式碼自己稽核




常見問題
1. 已經做過一次git review,但是程式碼還沒有codereview。此時,想把原生程式碼中新的修改合入到上一次review的http://10.0.0.4/#/c/kaishustory/+/221/ 地址中,使用如下方式:

