安装完成第一个登录的用户会做为管理员
登录成功
git
2.1 Full Name
填入gerrit
点击Save Changes保存
2.2 Add SSH Public Key
生成公钥sql
[gerrit@localhost ~]$ ssh-keygen -t rsa -C gerrit@test.com
[gerrit@localhost ~]$ cat .ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCydyztelLyfuP1plXLOHvaC8mw2QMa5SJI+LRW+ngczDFTpLCarzS3osDGqsDmYGMKy6D6dR+Y7yXHqnKiBWiMArncGF1AXRw09TKG+A6X2LcfAz532Q6c2oL/y782xU6SmJFZNLzBE3kix+Pe9Lh4HPlfTiCKjZVYBaKXVC9nkZAzrqrWhHfdJ6fPiPUuvJQeUkHKjZfHIEkf7BSeIbmjd3BvUTXBUs451BmT0wvTP/K5W5OlVeUrhYmfo9hhuFt2+sT4M1rG4AfS8v7w/hfqPOWlB284HXrG/bwFjdv1P4VD4Yl5TxK2XboVSPaFEHkpx0a7fCqr+BDXOWm6Qj/1 gerrit@test.com
复制并添加
到此完成了最基本的设置,其余帐户也按照此方法设置。shell
[gerrit@localhost ~]$ htpasswd -m /home/gerrit/gerrit.password highgo New password: Re-type new password: Adding password for user highgo
登录,完成基本设置数据库
因为搭建过程当中没有配置邮箱因此不能经过网页注册邮箱,只能由管理员直接操做数据库,添加邮箱信息。ssh
[gerrit@localhost ~]$ ssh -p 29418 -i ~/.ssh/id_rsa 192.168.81.183 -l gerrit The authenticity of host '[192.168.81.183]:29418 ([192.168.81.183]:29418)' can't be established. RSA key fingerprint is SHA256:J2gpT+hNoOXQMgWLihVa/sHoYJi9v0rZ6bfG/O6NQ8g. RSA key fingerprint is MD5:8d:88:d7:23:c9:c0:b1:48:6e:b0:e9:cb:dc:70:12:5b. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '[192.168.81.183]:29418' (RSA) to the list of known hosts. **** Welcome to Gerrit Code Review **** Hi gerrit, you have successfully connected over SSH. Unfortunately, interactive shells are disabled. To clone a hosted Git repository, use: git clone ssh://gerrit@192.168.81.183:29418/REPOSITORY_NAME.git Connection to 192.168.81.183 closed.
若是出现以下提示,说明没有权限操做测试
[gerrit@localhost ~]$ ssh -p 29418 -i ~/.ssh/id_rsa 192.168.81.183 -l gerrit gerrit gsql fatal: gerrit does not have "Access Database" capability.
此时以管理员登录gerrit
点击Projects => List => All-Projects => Access => Edit
在 Global Capabilities 那部分添加Access Database权限,最后记得点击Save Changes保存
code
再次链接就有权限了图片
[gerrit@localhost ~]$ ssh -p 29418 -i ~/.ssh/id_rsa 192.168.81.183 -l gerrit gerrit gsql Welcome to Gerrit Code Review 2.12.4 (H2 1.3.176 (2014-04-05)) Type '\h' for help. Type '\r' to clear the buffer. gerrit> select * from ACCOUNT_EXTERNAL_IDS; ACCOUNT_ID | EMAIL_ADDRESS | PASSWORD | EXTERNAL_ID -----------+---------------+----------+---------------- 1000000 | NULL | NULL | gerrit:gerrit 1000000 | NULL | NULL | username:gerrit 1000001 | NULL | NULL | gerrit:highgo 1000001 | NULL | NULL | username:highgo (4 rows; 3 ms) gerrit>
添加邮箱ci
gerrit> insert into ACCOUNT_EXTERNAL_IDS values('1000000', 'gerrit@test.com', 'NULL', 'mailto:gerrit@test.com'); UPDATE 1; 1 ms gerrit> insert into ACCOUNT_EXTERNAL_IDS values('1000001', 'highgo@test.com', 'NULL', 'mailto:highgo@test.com'); UPDATE 1; 0 ms gerrit> select * from ACCOUNT_EXTERNAL_IDS; ACCOUNT_ID | EMAIL_ADDRESS | PASSWORD | EXTERNAL_ID -----------+-----------------+----------+----------------------- 1000000 | NULL | NULL | gerrit:gerrit 1000000 | NULL | NULL | username:gerrit 1000001 | NULL | NULL | gerrit:highgo 1000001 | NULL | NULL | username:highgo 1000000 | gerrit@test.com | NULL | mailto:gerrit@test.com 1000001 | highgo@test.com | NULL | mailto:highgo@test.com (6 rows; 0 ms)
使添加信息生效rem
[gerrit@localhost ~]$ ssh -p 29418 -i ~/.ssh/id_rsa 192.168.81.183 -l gerrit gerrit flush-caches
而后就能够在网页中设置邮箱了
管理员监听提交
highgo用户clone工程
[highgo@localhost ~]$ git clone ssh://highgo@192.168.81.183:29418/Test.git
添加文件修改
[highgo@localhost ~]$ cd Test/ [highgo@localhost Test]$ touch TestFile.txt [highgo@localhost Test]$ echo "Test Test Test" >> TestFile.txt
提交
[highgo@localhost Test]$ git add TestFile.txt [highgo@localhost Test]$ git config user.name highgo [highgo@localhost Test]$ git config user.email highgo@test.com [highgo@localhost Test]$ git config remote.origin.push refs/heads/*:refs/for/* [highgo@localhost Test]$ scp -p -P 29418 highgo@192.168.81.183:hooks/commit-msg .git/hooks/ commit-msg 100% 4662 1.4MB/s 00:00 [highgo@localhost Test]$ git commit -m "add TestFile" [master 428b57a] add TestFile 1 file changed, 1 insertion(+) create mode 100644 TestFile.txt [highgo@localhost Test]$ git push Counting objects: 4, done. Writing objects: 100% (3/3), 284 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: Processing changes: new: 1, refs: 1, done remote: remote: New Changes: remote: http://192.168.81.183:8081/1 add TestFile remote: To ssh://highgo@192.168.81.183:29418/Test.git * [new branch] master -> refs/for/master [highgo@localhost Test]$
管理员查看提交
审核并经过
到此完成了基本的简单使用介绍