当前位置:   article > 正文

Git Gerrit 使用时候的坑,自动创建合并请求_gerrit 怎样拉起合并请求

gerrit 怎样拉起合并请求

使用Gerrit时候提交不成功,提示没有权限。

remote: ERROR: commit 00036e1: missing Change-Id in message footer
remote: Hint: to automatically insert a Change-Id,install the hook:
remote:	gitdir=$(git rev-parse --git-dir); scp -p -P 28110 username@127.0.0.1:hooks/commit-msg ${gitdir}/hooks/
remote: and then amend the commit:
remote:	git commit --amend --noedit
remote: Finally, push your changes again
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

其实原因

  • 没有设置正确的邮箱地址,邮箱地址必须跟gerrit上设置的一样
  • 其次在创建分支的时候,没有执行完整,而是直接复制git仓库地址git clone XXX。

之前一直使用GitLab,所以每次都是手动创建合并请求,而 Gerrit 可以通过这种方式自动创建合并请求

解决办法

1.重新拉去仓库到本地,执行完整的代码

git clone "ssh://username@127.0.0.1:2811/repo" && scp -p -P 2811 username@127.0.0.1:hooks/commit-msg "go-server/.git/hooks/"
  • 1

2.递交的时候先commit到本地分支再

git commit -m "备注内容"
git push origin HEAD:refs/for/develop
git push origin HEAD:refs/for/v1.0.10
  • 1
  • 2
  • 3

develop 是你要递交的分支,提交成功后,Gerrit 会默认在上面创建合并请求。

Enumerating objects: 19, done.
Counting objects: 100% (19/19), done.
Delta compression using up to 12 threads
Compressing objects: 100% (10/10), done.
Writing objects: 100% (11/11), 7.44 KiB | 3.72 MiB/s, done.
Total 11 (delta 7), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (7/7)
remote: Processing changes: refs: 1, new: 1, done
remote:
remote: SUCCESS
remote:
remote:   http://127.0.0.1/c/repo/+/1671 提交的备注内容 [NEW]
remote:
To ssh://127.0.0.1:2811/repo
 * [new branch]      HEAD -> refs/for/dev
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/68182
推荐阅读
相关标签
  

闽ICP备14008679号