Gerrit 使用

参考Gerrit的使用说明 
ssh -p 29418 hwh@188.188.1.9 gerrit --help
可以查看每一个命令的说明:比如create-project 
ssh -p 29418   hwh@188.188.1.9 gerrit create-project --help 

1.创建项目(必须要有管理员权限) 
ssh -p 29418   hwh@188.188.1.9 gerrit create-project -p All-Projects -n Art --empty-commit 
可以在本机上使用:  29418 gerrit服务器端口,hwh是gerrit账号,  188.188.1.9 服务器地址  
gerrit create-project 用gerrit来创建项目 -p All-Projects 权限从All-Projects继承 p是父项目 
-n Art project名字是Art --empty-commit 项目创建时,加一个空提交。
2.删除gerrit用户 
ssh -p 29418   zbb@review.mdaxue.com gerrit gsql 
delete from ACCOUNT_EXTERNAL_IDS where external_id='username:zzy'; 
3、从git服务器获取代码 
git clone   http://188.188.1.9/Art
git clone ssh://hwh@188.188.1.9:29418/Art 
4.创建http登录帐号 
htpasswd -b ./review_site/etc/passwd hwh 123456 
更新账户,htpasswd -b ./review_site/etc/passwd hwh 12345678
5.管理员创建邮箱 
回到本机通过ssh远程连接创建邮箱 
$ cat ~/.ssh/config  
 Host ha 
     HostName 192.168.1.99 
     User root 
     Port 29418 
     IdentityFile ~/.ssh/id_rsa 

 $ ssh ha gerrit set-account --add-email accountemail accountname 

6、删除项目 
到gerrit服务器里,直接删除该项目比如:test.git 
重启gerrit服务器,进去看list,发现这个项目没有了。 

7、push代码和tags 
 git push --tags origin HEAD:refs/heads/qmc-8974-la-4.0.2-ref 
把从高通下载的代码和tag一起push到服务器,结果是代码可以push,tag不能。 

自己新建一个git,加上代码和tag,push的服务器,结果是可以push。 

查找权限,refs/heads/*已经有权限了,可以push code,所以我们要查找tag的权限,refs/tags/*的权限也都有了。所以我们自己的git可以push code和代码,但是为什么别人的code不能push tag呢?需要加Forge Author Identity和Forge Committer Identity 



Forge Author 
Normally Gerrit requires the author and the committer identity lines in a Git commit object (or tagger line in an annotated tag) to match one of the registered email addresses of the uploading user. This permission allows users to bypass parts of that validation, which may be necessary when mirroring changes from an upstream project. 

Permits the use of an unverified author line in commit objects. This can be useful when applying patches received by email from 3rd parties, when cherry-picking changes written by others across branches, or when amending someone else’s commit to fix up a minor problem before submitting. 

By default this is granted to Registered Users in all projects, but a site administrator may disable it if verified authorship is required. 

Forge Committer 
Normally Gerrit requires the author and the committer identity lines in a Git commit object (or tagger line in an annotated tag) to match one of the registered email addresses of the uploading user. This permission allows users to bypass parts of that validation, which may be necessary when mirroring changes from an upstream project. 

Allows the use of an unverified committer line in commit objects, or an unverified tagger line in annotated tag objects. Typically this is only required when mirroring commits from an upstream project repository. 

Forge Server 
Normally Gerrit requires the author and the committer identity lines in a Git commit object (or tagger line in an annotated tag) to match one of the registered email addresses of the uploading user. This permission allows users to bypass parts of that validation, which may be necessary when mirroring changes from an upstream project. 

Allows the use of the server’s own name and email on the committer line of a new commit object. This should only be necessary when force pushing a commit history which has been rewritten by git filter-branch and that contains merge commits previously created by this Gerrit Code Review server. 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Gerrit是一个用于代码审查和版本控制的工具,它的使用可以通过一系列步骤来完成。以下是一个简单的Gerrit使用教程: 1. 首先,你需要了解Gerrit的工作流程和权限控制。这可以通过阅读相关的文档和教程来获得大致的了解。你也可以参考一些博客文章,比如【GerritGerrit工作流程及使用手册。 2. 作为管理员,你可以通过命令行对Gerrit服务器进行操作。你可以使用如下命令连接到服务器:ssh gerrit -l admin。连接成功后,你就可以对Gerrit进行各种管理操作了,比如添加普通成员。 3. 在使用Gerrit之前,你需要激活账号并生成SSH密钥。你可以在本地生成SSH密钥对,并将公钥配置到Gerrit服务器中。 4. 下载代码:在Gerrit的页面上,你可以浏览项目并进行查看。你可以使用过滤器来快速搜索你感兴趣的项目。找到你想要下载的项目后,可以点击浏览页面下的repositories进行查看。在这里,你可以选择下载代码。 5. 修改与提交:在本地进行代码修改后,你可以使用git命令将修改提交到Gerrit服务器。在提交后,Gerrit会为每次提交生成一个change id,并在Gerrit中生成一个review请求。 6. Gerrit页面进行代码审核并合并至远程分支:在Gerrit页面上,你可以对提交的代码进行审核。审核包括对代码质量、风格等方面的评审。如果审核通过,你可以将代码合并至远程分支。 7. 远程合并后本地需要git pull更新同步:在远程合并之后,你需要在本地使用git pull命令来更新同步。之后,你可以使用git log命令来查看更新后的代码。 以上是一个简单的Gerrit使用教程,希望对你有所帮助。如果你还有其他问题,请随时提问。<span class="em">1</span><span class="em">2</span><span class="em">3</span><span class="em">4</span>

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值