Gerrit 使用

来源:互联网 发布:sql server恢复数据库 编辑:程序博客网 时间:2024/05/22 02:04
参考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 
git clone  http://hwh@188.188.1.9/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. 

0 0