Gerrit

安装准备

安装gerrit

运行gerrit

注册用户

生成ssh私钥和公钥

# 生成私钥和公钥
$ ssh-keygen -t rsa -C "zenki2001cn@163.com"

# 添加以下信息到~/.ssh/config,用来管理登录信息
Host zenki-ubuntu
  Hostname zenki-ubuntu
  Port 29418
  User Zenki
  IdentityFile ~/.ssh/id_rsa

# 添加rsa密钥
$ ssh-add ~/.ssh/id_rsa

# 启用ssh-agent
$ ssh-agent 

注册账户和配置

验证账户

$ ssh -p 29418 zenki@localhost

# 出现以下信息时,说明ssh能够正常工作:
 ****    Welcome to Gerrit Code Review    ****

  Hi demo, you have successfully connected over SSH.

  Unfortunately, interactive shells are disabled.
  To clone a hosted Git repository, use:

  git clone ssh://demo@localhost:29418/REPOSITORY_NAME.git

Connection to localhost closed.

使用gerrit

创建项目

下载代码

# ssh方式
$ git clone ssh://Zenki.J.Zha@127.0.0.1:29418/Gerrit_project_test.git
# http方式
$ git clone http://Zenki.J.Zha@127.0.0.1:8080/Gerrit_project_test.git
# https方式,如果之前配置了SSL加密
$ git clone https://Zenki.J.Zha@127.0.0.1:8080/Gerrit_project_test.git

提交代码

配置提交页面

参考链接