LDAP + redmine + gerrit + jenkins + gitlab -- 添加已有git仓库到gerrit
2017-12-07 23:14
465 查看
环境
gerrit上已有两个账号, shuhm和temp, 其中shuhm为管理员testgerrit为本地git仓库
配置gerrit发送邮件
编辑gerrit_site/etc/gerrit.config, 其中gerrit_site为gerrit的安装目录
[sendemail] smtpServer = smtp.263.net smtpServerPort = 587 #smtpEncryption = ssl smtpUser = shuhm@r7data.com smtpPass = xxxxxx sslVerify = false from=CodeReview<gerrit@r7data.com>
创建Project
先通过gerrit web 创建Project, test添加本地git仓库
通过管理员账号将已有git仓库推到gerrit→ testgerrit (master) git push -u ssh://shuhm@172.16.6.220:29418/test.git master
clone gerrit 仓库
普通账号将仓库从gerrit clone到本地→ git clone ssh://temp@172.16.6.220:29418/test.git
→ test (master) ls
README.md
修改README.md, 并commit
→ test (master) echo "world" >> README.md → test (master) git add README.md → test (master) git commit -m "add world" [master 580bc0e] add world Committer: Kylin <kylin@localhost.localdomain> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file: git config --global --edit After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 1 file changed, 1 insertion(+)
push到gerrit
→ test (master) git push ssh://temp@172.16.6.220:29418/test.git Counting objects: 3, done. Writing objects: 100% (3/3), 261 bytes | 261.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: Branch refs/heads/master: remote: You are not allowed to perform this operation. remote: To push into this reference you need 'Push' rights. remote: User: temp remote: Please read the documentation and contact an administrator remote: if you feel the configuration is incorrect remote: Processing changes: refs: 1, done To ssh://172.16.6.220:29418/test.git ! [remote rejected] master -> master (prohibited by Gerrit: ref update access denied) error: failed to push some refs to 'ssh://temp@172.16.6.220:29418/test.git'
配置remote.origin.push
, 再次push
→ test (master) git config remote.origin.push refs/heads/*:refs/for/* → test (master) git push ssh://temp@172.16.6.220:29418/test.git HEAD:refs/for/master Counting objects: 3, done. Writing objects: 100% (3/3), 261 bytes | 261.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: Processing changes: refs: 1, done remote: remote: ERROR: In commit 580bc0ebae7f7e752b25e9c7ba0b405c37897d61 remote: ERROR: committer email address kylin@localhost.localdomain remote: ERROR: does not match your user account. remote: ERROR: remote: ERROR: You have not registered any email addresses. remote: ERROR: remote: ERROR: To register an email address, please visit: remote: ERROR: http://172.16.6.220:9080/#/settings/contact remote: remote: To ssh://172.16.6.220:29418/test.git ! [remote rejected] HEAD -> refs/for/master (invalid committer) error: failed to push some refs to 'ssh://temp@172.16.6.220:29418/test.git'
配置Email, 再次push
登录gerrit web -> Settings -> Contact Information -> Register New Email … 然后登录邮箱进行验证→ test (master) git config user.email 84567012@qq.com → test (master) git push Counting objects: 3, done. Writing objects: 100% (3/3), 261 bytes | 261.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: Processing changes: refs: 1, done remote: remote: ERROR: In commit 580bc0ebae7f7e752b25e9c7ba0b405c37897d61 remote: ERROR: committer email address kylin@localhost.localdomain remote: ERROR: does not match your user account. remote: ERROR: remote: ERROR: The following addresses are currently registered: remote: ERROR: 84567012@qq.com remote: ERROR: remote: ERROR: To register an email address, please visit: remote: ERROR: http://172.16.6.220:9080/#/settings/contact remote: remote: To ssh://172.16.6.220:29418/test.git ! [remote rejected] master -> refs/for/master (invalid committer) error: failed to push some refs to 'ssh://temp@172.16.6.220:29418/test.git'
更正comment, 再次push
→ test (master) git log commit 580bc0ebae7f7e752b25e9c7ba0b405c37897d61 (HEAD -> master) Author: Kylin <kylin@localhost.localdomain> Date: Thu Dec 7 21:15:31 2017 +0800 add world → test (master) git commit --amend → test (master) git push Counting objects: 3, done. Writing objects: 100% (3/3), 281 bytes | 281.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: Processing changes: refs: 1, done remote: ERROR: [f7916cd] missing Change-Id in commit message footer remote: remote: Hint: To automatically insert Change-Id, install the hook: remote: gitdir=$(git rev-parse --git-dir); scp -p -P 29418 temp@172.16.6.220:hooks/commit-msg ${gitdir}/hooks/ remote: And then amend the commit: remote: git commit --amend remote: To ssh://172.16.6.220:29418/test.git ! [remote rejected] master -> refs/for/master ([f7916cd] missing Change-Id in commit message footer) error: failed to push some refs to 'ssh://temp@172.16.6.220:29418/test.git'
添加hook, 再次push
→ test (master) gitdir=$(git rev-parse --git-dir); scp -p -P 29418 temp@172.16.6.220:hooks/commit-msg ${gitdir}/hooks/ commit-msg 100% 4693 3.1MB/s 00:00 → test (master) git commit --amend [master df26fa4] add world Author: Kylin <kylin@localhost.localdomain> Date: Thu Dec 7 21:15:31 2017 +0800 1 file changed, 1 insertion(+) → test (master) git push Counting objects: 3, done. Writing objects: 100% (3/3), 320 bytes | 320.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: Processing changes: new: 1, refs: 1, done remote: remote: New Changes: remote: http://172.16.6.220:9080/1 add world remote: To ssh://172.16.6.220:29418/test.git * [new branch] master -> refs/for/master
相关文章推荐
- LDAP + redmine + gerrit + jenkins + gitlab -- LDAP配置
- LDAP + redmine + gerrit + jenkins + gitlab -- 使用LAM(LDAP Account Manager)管理用户
- CentOS配置Gerrit Gitlab Jenkins--Gerrit添加Jenkins(6)
- 团队开发利器Redmine,git,gerrit,jenkins
- Ubuntu上搭建Gitlab指南(附添加已有Git工程到Gitlab方法)
- CentOS配置Gerrit Gitlab Jenkins--Gerrit添加reviewer(5)
- git gitlab github gerrit jenkins
- 软件项目管理平台:repo+gerrit+jenkins+gitlab+sonar+redmine
- gitlab & gerrit & git & repo & jenkins
- 给Xcode已有项目添加git代码仓库
- git 添加远程仓库遇到的问题
- CI持续集成系统环境--Gitlab+Gerrit+Jenkins完整对接
- git 本地添加远程仓库
- git 添加远程仓库
- Git添加到远程仓库
- linux 下 将一个已有目录添加到git服务器
- 【GitLab】git一个项目托管到两个远程仓库
- CI持续集成系统环境--Gitlab+Gerrit+Jenkins完整对接
- jenkins+gitlab钩子+shell脚本基于git的tag实现App增量更新
- 【Git学习笔记】对已经添加到仓库的文件修改后再次提交到仓库