教你如何使用Gerrit
前言:
基于上一篇博客《Gerrit服务器搭建》,现在开始教大家如何使用Gerrit(我用的是V2.10),对于没接触过服务器的我,研究起来真的费劲。之所以写这篇博客,是因为网上的那些文章很多细节问题没有写到,一方面给自己留笔记,其次分享给大家。
一、注册邮箱


二、新建项目

三、克隆项目及拷贝commit_msg脚本至本地
前半部分是拷贝项目,后半部分是将commit-msg脚本拷贝至你本地的.git/hooks目录下。这个脚本的目的是在你提交的时候自动加上Change-Id。

四、项目提交及推送
如果你在提交代码前没有把commit-msg脚本下载下来,push时会出现这样的情况(missing or invalid Change-Id line format in commit message footer):
MacBook-Pro:JSQB GaoSir$ git push origin HEAD:refs/for/develop Counting objects: 10, done. Delta compression using up to 4 threads. Compressing objects: 100% (9/9), done. Writing objects: 100% (10/10), 781 bytes | 0 bytes/s, done. Total 10 (delta 5), reused 0 (delta 0) remote: Resolving deltas: 100% (5/5) remote: Processing changes: refs: 1, done remote: ERROR: missing or invalid Change-Id line format in commit message foote remote: Suggestion for commit message: remote: 测试Gerrit2 remote: remote: remote: Change-Id: I remote: remote: Hint: To automatically insert Change-Id, install the hook: remote: gitdir=$(git rev-parse --git-dir); scp -p -P 29418 admin@172.16.8.2:hooks/commit-msg ${
gitdir}/hooks/ remote: remote: To http://172.16.8.2:8090/JSQB ! [remote rejected] HEAD -> refs/for/develop (missing or invalid Change-Id line format in commit message footer) error: failed to push some refs to 'http://admin@172.16.8.2:8090/JSQB'
怎么办?
再重新提交和推送。
如果遇到:
no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
在.ssh文件夹下的config文件中添加以下内容(如果没有,新建一个config文件,名字就叫config,没有后缀)
Host * KexAlgorithms +diffie-hellman-group1-sha1
五、设置权限
- 代码审核:
需+2 approved之后才算审核完全通过,进入下一阶段; - 代码通过:
该权限下的用户如果verified了这次提交,那么进入下一阶段; - 代码提交:
该权限下的用户可以进行submit,最终代码成功合入分支。
完了?
嗯,暂时到此为止,后续再完善,到现在饭都没吃。
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/229235.html原文链接:https://javaforall.net
