測試Gerrit SSH連接
Gerrit安裝好之後,我們需要只有將gerrit上的clone下來,才能進行修改提交,並進行review。
gerrit支持兩種方式下載代碼:ssh和http。
使用ssh的連接操作如下:,gerrit網址url爲:http://review.gerritsite.com/
1.本地生成ssh key,並貼到gerrit上。
- 使用ssh-keygen命令,可以在本地賬戶的.ssh目錄下生成公鑰和私鑰
- 登錄gerrit,將~/.ssh/id_rsa.pub,複製粘貼到gerrit複製到:http://review.gerritsite.com/#/settings/ssh-keys,可以添加多個。
2.測試鏈接
公鑰添加到gerrit上之後,就可以通過ssh命令來測試連接,gerrit的ssh默認端口號是29418;如果出現如下內容,表示連接成功。
$ ssh -p 29418 [email protected]
**** Welcome to Gerrit Code Review ****
Hi John Doe, you have successfully connected over SSH.
Unfortunately, interactive shells are disabled.
To clone a hosted Git repository, use:
git clone ssh://[email protected]:29418/REPOSITORY_NAME.git
Connection to hostname closed.
3.獲取端口信息
通過curl命令,獲取gerrit網站的ssh信息
$ curl http://review.gerritsite.com/ssh_info
review.gerritsite.com 29418