download-commands插件配置

[download]               scheme = sshscheme = http      #认证http下载scheme = anon_http    #匿名http下载scheme = anon_gitscheme = repo_download

If download.scheme is not specified, SSH, HTTP and Anonymous HTTP downloads are allowed.

reviewnotes插件

Stores review information for Gerrit changes in the refs/notes/review branch.
存储仓库审查信息在refs/notes/review分支中

git fetch origin refs/notes/review:refs/remotes/origin/notes/review
git checkout notes/review
git log  #查看审查记录

singleusergroup插件

This plugin provides a group per user. This is useful to assign access rights directly to a single user, since in Gerrit access rights can only be assigned to groups.

refs/meta/config分支

任何项目默认继承All-Projects权限,refs/meta/config是项目管理访问控制分支

git clone ssh://admin@localhost:29418/All-Projects && scp -p -P 29418 admin@localhost:hooks/commit-msg All-Projects/.git/hooks/#refs/meta/config 是All-Projects的引用
git fetch origin refs/meta/config:refs/remotes/origin/meta/config
git checkout meta/config
#现在目录下有groups  project.config两个文件
#groups文件包含project.config中需要的用户组和对应的UUID
#例如:在project.config中添加新的ldap群组时需要groups文件添加ldap群组对应的关系#提交修改
git add .
git commit -m "modify config"
git push origin meta/config:meta/config

通过restful接口访问gerrit

[auth]type=ldapgitBasicAuth=trueuserNameToLowerCase=true
#需要设置gitBasicAuth为true
#请求中带有HTTP basic authentication信息

命令行工具

ssh -p 29418 admin@localhost gerrit --help
apropos              Search in Gerrit documentation
ban-commit           Ban a commit from a project's repository
close-connection     Close the specified SSH connection
create-account       Create a new batch/role account
create-branch        Create a new branch
create-group         Create a new account group
create-project       Create a new project and associated Git repository
flush-caches         Flush some/all server caches from memory
gc                   Run Git garbage collection
gsql                 Administrative interface to active database
index
logging
ls-groups            List groups visible to the caller
ls-members           List the members of a given group
ls-projects          List projects visible to the caller
ls-user-refs         List refs visible to a specific user
plugin
query                Query the change database
receive-pack         Standard Git server side command for client side git push
rename-group         Rename an account group
review               Apply reviews to one or more patch sets
set-account          Change an account's settings
set-head             Change HEAD reference for a project
set-members          Modify members of specific group or number of groups
set-project          Change a project's settings
set-project-parent   Change the project permissions are inherited from
set-reviewers        Add or remove reviewers on a change
show-caches          Display current cache statistics
show-connections     Display active client SSH connections
show-queue           Display the background work queues
stream-events        Monitor events occurring in real time
test-submit
version              Display gerrit version#查看各个命令帮助
ssh -p 29418 admin@localhost gerrit <command> --help#查看缓存
ssh -p 29418 admin@localhost gerrit show-caches
#在一些项目/用户权限修改时,清除缓存
ssh -p 29418 admin@localhost gerrit flush-caches --all#通过gerrit登录数据库
ssh -p 29418 admin@localhost gerrit gsql
fatal: admin does not have "Access Database" capability.
#修改All-Projects的refs/meta/config分支下project.config文件
[capability]accessDatabase = group Administrators#查看可见的群组
ssh -p 29418 admin@localhost gerrit ls-groups
#创建新的项目,--owner需要的群组必须要在Gerrit已经定义好的
ssh -p 29418 admin@localhost gerrit create-project "test/helloworld" --description "'Tools used by build system'" --owner "user/admin" --parent "All-Projects"
#修改项目配置
ssh -p 29418 admin@localhost gerrit set-project "repo_name" --project-state ACTIVE --submit-type FAST_FORWARD_ONLY
#设置继承项目
ssh -p 29418 admin@localhost gerrit set-project-parent "repo_name" --parent "parent_repo"
#自动审查打分
ssh -p 29418 admin@localhost gerrit review {COMMITID | CHANGEID,PATCHSET} --verified +1 --code-review +1 --message "review from ssh"


可以是COMMITID格式:ad30e89642,也可以是CHANGEID,PATCHSET格式:12,1

Searching Changes

Searching Changes 可以通过搜索栏搜索,也可以通过ssh命令行搜索

Description Default Query
All > Open status:open ‘(or is:open)’
All > Merged status:merged
All > Abandoned status:abandoned
My > Drafts owner:self is:draft
My > Watched Changes status:open is:watched
My > Starred Changes is:starred
My > Draft Comments has:draft
Open changes in Foo status:open project:Foo
#查看myProject项目status:open状态的补丁
ssh -p 29418 admin@localhost gerrit query --format=JSON status:open project:myProject limit:2

gerrit配置认证方式为HTTP,认证过程由代理服务器完成,提交代码使用ssh协议更方便

配置认证方式为ldap, gerrit提示用户输入用户名和密码,然后它通过对配置的ldap.server执行一个简单的绑定验证,代理服务器不在参与认证过程

如果使用http提交,修改远程的地址为gerrit监听地址,提交时输入生成的密码

git remote -v
git remote remove origin
git remote add origin http://admin@localhost:8081/myProject

gerrit http的URL

#fetch
/test_repo/info/refs?service=git-upload-pack HTTP/1.1
#push
/test_repo/info/refs?service=git-receive-pack HTTP/1.1


导入git仓库到gerrit

gerrit在启动或者清除缓存的时候会检测仓库路径的仓库
1. 如果导入的git仓库是gerrit bare仓,直接复制到gerrit仓库目录下,或者重新指定gerrit仓库路径

#复制bare仓到gerrit仓库路径
#更新缓存
ssh -p 29418 admin@localhost gerrit flush-caches --all
  1. 如果导入的git仓库不是bare仓,在gerrit中新建一个project,不要做init commit,修改本地仓库远程地址后push到gerrit
ssh -p 29418 admin@localhost gerrit create-project tools/gerrit.git --description "'Tools used by build system'"

下载更新正常,提交时出现下面错误

git push origin HEAD:refs/for/master
remote: Unauthorized
fatal: Authentication failed for 'http://chenjianhua@localhost:8090/test_repo/'#直接向8081端口提交
git push http://chenjianhua@localhost:8090/test_repo/ HEAD:refs/for/master
Total 3 (delta 0), reused 0 (delta 0)
remote: Processing changes: new: 1, refs: 1, done
remote:
remote: New Changes:
remote:   http://localhost:8090/3 modify hello.c
remote:
To http://chenjianhua@localhost:8081/test_repo/* [new branch]      HEAD -> refs/for/master

可以clone的原因是默认支持匿名下载,但是上传不可以.
估计跟代理服务器配置有关,改用haproxy代理了.

avatars/external插件

#图片地址: https://avatars1.githubusercontent.com/u/3890847?v=3&s=140
#必须带有参数${user}
[plugin "avatars-external"]url = https://avatars1.githubusercontent.com/u/3890847?v=3&s=140&no_use=${user}


修改gerrit数据库

注册不了邮箱,只能手动添加邮箱进行测试了

#停止gerrit
./bin/gerrit.sh stopjava -jar bin/gerrit.war gsql
Type '\h' for help.  Type '\r' to clear the buffer.gerrit> \h
General\q        quitInformational\d        list all tables\d NAME   describe table
#查询账号信息
SELECT * FROM ACCOUNTS;
#更新邮箱
UPDATE ACCOUNTS SET PREFERRED_EMAIL='email' WHERE ACCOUNT_ID = '1000000';
UPDATE ACCOUNT_EXTERNAL_IDS SET EMAIL_ADDRESS='2290910211@qq.com' WHERE ACCOUNT_ID = '1000000';

遇见的问题

1. Cannot initialize schema

Exception in thread "main" com.google.gwtorm.server.OrmException: Cannot initialize schemaat com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:101)at com.google.gerrit.pgm.init.BaseInit$SiteRun.upgradeSchema(BaseInit.java:339)at com.google.gerrit.pgm.init.BaseInit.run(BaseInit.java:120)

输入的仓库目录中已经有了All-Projects.git,All-Users.git仓库

2. not provide the username in the SM_USER header


安装时Get username from custom HTTP header选择No

参照

  • https://gerrit-ci.gerritforge.com/
  • https://gerrit.googlesource.com/
  • http://localhost:8090/Documentation/access-control.html#_all_projects
  • RestAPI
  • dev-design
  • config-plugins
  • http://blog.bruin.sg/2013/04/how-to-edit-the-project-config-for-all-projects-in-gerrit/
  • import-repository-from-git-to-gerrit

gerrit配置管理相关推荐

  1. Android下的配置管理之道之主从gerrit配置使用replication插件

    gerrit配置使用replication插件 最终实现的效果如下图所示 实现员工下带代码从一个从gerrit下载,上传代码到主gerrit上. 首先是主gerrit服务器上面要配置一下ssh相关的 ...

  2. Gerrit码仓之分配权限使用方法秘籍

    描述: 百度百科:Gerrit,一种免费.​​开放源代码​​的代码审查软件,使用网页界面. 需求:根据公司要求配置管理Gerrit码仓,因Gerrit的自身界面以及长时间使用gitlab的习惯,一时间 ...

  3. 码农技术炒股之路——配置管理器、日志管理器

    配置管理器和日志管理器是项目中最为独立的模块.我们可以很方便将其剥离出来供其他Python工程使用.文件的重点将是介绍Python单例和logging模块的使用.(转载请指明出于breaksoftwa ...

  4. Distributed Configuration Management Platform(分布式配置管理平台)

    2019独角兽企业重金招聘Python工程师标准>>> 专注于各种 分布式系统配置管理 的通用组件/通用平台, 提供统一的配置管理服务. 主要目标: 部署极其简单:同一个上线包,无须 ...

  5. Spring Cloud应用开发(七:使用Git存储方式实现分布式配置管理 )

    1.使用Git存储实现管理: 1.1.配置Git.在Git上创建microservice-study-config目录,并在目录中添加开发,预发布和测试的配置文件: 1.2.修改服务端配置文件.将mi ...

  6. 数据通信技术(二:交换机配置管理)

    交换机配置与管理(思科模拟器) 1.从用户模式进入特权模式,并进入配置模式设置进入特权模式的密码; 2.进入交换机的端口模式并进行端口状态的设置; 用新密码登录并查看接口状态信息,重启交换机; 4.硬 ...

  7. [原创]Gerrit中文乱码问题解决方案分享

    应开发同事的要求,部署了Gitlab+Gerrit+Jenkins的持续集成环境. 但是发现了一个问题,Gerrit登陆后有中文乱码出现. 具体情况如下: (1)Git代码中的中文乱码处理: 为妥善解 ...

  8. server缺少sqlexpress sql_SQL Server----解决SQL Server 配置管理器不见了

    错误重现: 之前安装好的SQL Server 2012打开都没有问题,好多天没有打开了,今天打开我的SQL Server 2012 连接时出现错误: 在与SQL Server 建立连接时出现与网络相关 ...

  9. docker运行gerrit(代码审查工具)

    gerrit是什么? Gerrit,一种免费.开放源代码的代码审查软件,使用网页界面. gerrit背景 Gerrit,一种免费.开放源代码的代码审查软件,使用网页界面.利用网页浏览器,同一个团队的软 ...

最新文章

  1. mysql 高级语法,SQL 语法高级
  2. 数据处理算法链接 DATA MINING GA LINK
  3. 前后对接数字几_开源数字货币交易所开发学习笔记(1)——系统架构
  4. KlayGE游戏引擎
  5. java正则表达式爬图片_Java正则表达式爬取网页,贴出完整代码
  6. android在activity之间传递map类型值
  7. 【2017级面向对象程序设计寒假作业】第4次作业情况
  8. 数字全息干涉偏振相移实验经验总结
  9. matlab 转子振动,转子—支承系统振动不平衡响应的MATLAB实现
  10. 计算机应用专业配置标准,计算机应用专业技能抽查考试标准.doc
  11. Quartus18.1安装USB Blaster驱动蓝屏
  12. lv双肩包尺寸对照表_当红Monogram帆布LV双肩包尺寸究竟有多少?
  13. 高效能人士的七个习惯简介
  14. c语言快排过程,快速排序(快排)C语言实现
  15. 音视频开发系列(7):完成本地摄像头直播推流
  16. Python基于Django航空飞机票预定网站设计
  17. 智能制造 | 机器视觉系统,直击纺织行业人工质检痛点难点,提升缺陷检出精准度至99.9%
  18. 自动驾驶TPM技术杂谈 ———— 超声波雷达系统测距
  19. SAPNoteSAR格式解压_SAP刘梦_新浪博客
  20. 国产的蓝光存储设备能算信创产品吗?

热门文章

  1. 算术基本定理证明相关引理与见解
  2. 黑盒测试-判定表驱动法与错误推测法-三角形问题
  3. java cometd_cometd使用-bayeux协议(读法:贝叶)
  4. Nature子刊 | 地下水固碳速率与寡营养海洋系统固碳速率相近
  5. 沈梦黑发骗子骗术揭秘
  6. 5个实用小技巧教你写出让用户欲罢不能的标题
  7. Mac 高效程序猿开发必备软件
  8. SurfaceLaptop2_BMR_46_13.1.7_2.zip恢复镜像网盘满速下载地址
  9. HTTP传递文件和接收文件处理之MultipartFile
  10. Win10 C盘爆红找出edb文件146G,删除后又出现如何解决