gerrit+gitlab出错记录

1、ssh-key

(1)出错信息:

正克隆到 'test-project1'...
Agent admitted failure to sign using the key.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
(2)解决方法:在当前用户下执行ssh-add

2、git提交出错

(1)命令:git push origin develop : develop

(2)出错信息:

error: dst ref refs/heads/develop receives from more than one src.
error: 无法推送一些引用到 'ssh://***@103.10.86.30:29418/test-project1'
(3)解决办法:将develop和冒号之间的空格去掉
3、gerrit的更新没有同步到gitlab:

除了检查权限配置以外,还需检查以下步骤:

1)用gerrit用户添加.gitreview文件

[root@localhost~]# su - gerrit
[gerrit@localhost ~]$ gitclone git@103.10.86.30:dev-group/test-project1.git
[gerrit@localhost~]$ cd test-project1
[gerrit@localhost test-project1]$ vim.gitreview

[gerrit]
host=103.10.86.30
port=29418
project=test-project1.git

2)添加.gitreview到版本库
[gerrit@localhosttest-project1]$ git add .gitreview
[gerrit@localhosttest-project1]$ git commit .gitreview -m 'add .gitreview file bygerrit.'
[gerrit@localhost test-project1]$ git push origin master

3)用gerrit用户在Gerrit上创建test-project1项目:

Projects->CreateNew Project,创建test-project1

4)将远程Gitlab上的test-project1项目发布到Gerrit

[gerrit@localhost~]$ cd /home/gerrit/gerrit_site/git/       
[gerrit@localhost git]$ rm -rftest-project1.git
[gerrit@localhost git]$ git clone --baregit@103.10.86.30:dev-group/test-project1.git                   


5)同步Gerrittest-project1项目到Gitlab

[gerrit@localhost~]$ cd /home/gerrit/gerrit_site/etc/
[gerrit@localhost etc] vimreplication.config
[remote"test-project1"]
projects = test-project1
url =git@103.10.86.30:dev-group/test-project1.git
push =+refs/heads/*:refs/heads/*
push = +refs/tags/*:refs/tags/*
push= +refs/changes/*:refs/changes/*
threads = 3

6)重新启动Gerrit服务:

[gerrit@localhost~]$ /home/gerrit/gerrit_site/bin/gerrit.sh restart


4、gerrit数据库登陆、查询、删除:

su - gerrit

1)停用gerrit

/home/gerrit/gerrit_site/bin/gerrit.sh stop

cd  /home/gerrit/gerrit_site/

2)登陆数据库

java -jar bin/gerrit.war gsql

3)查找change id

select * from PATCH_SETS;

4)删除数据(change id栏为你需要删除行的change id)

delete from PATCH_SETS where change_id=3;


分支合并导致gerrit审核出错

[user@localhost~]$ cd test-project1/

[user@localhost test-project1]$ gitbranch develop //创建分支develop

[user@localhost test-project1]$ git pushorigin develop: develop

[user@localhost test-project1]$ gitcheckout develop //切换分支

[user@localhost test-project1]$ touchbr-file

[user@localhost test-project1]$ git add.

[user@localhost test-project1]$ gitcommit -m "add br-file for testing branch"

[user@localhost test-project1]$ git pushorigin HEAD:refs/for/develop //提交到Gerrit进行代码审查

如果此处没有等到代码审查结束就直接切换到master分支进行合并,gerrit审核通过submit的时候就会报错

[user@localhost test-project1]$ gitcheckout master

[user@localhost test-project1]$ gitmerge --no-ff develop //develop分支合并到master

[user@localhost test-project1]$ git pushorigin //上传


5[user@localhost ~]$ git clone git@192.168.0.1:dev-group/test-project1.git会需要密码,是需要先执行以下操作:

1、上传用户公钥到gitlab上;

2、在本地设置全局变量:

git config --global user.name "user"

git config --global user.email "user@126.com"

之后再执行操作即可





              



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值