gerrit 同步gitlab

Posted 刘球球

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了gerrit 同步gitlab相关的知识,希望对你有一定的参考价值。

1.安装gerrit replication插件

unzip gerrit.war
cp WEB-INF/plugins/replication.jar ~/temp/
ssh -p 29418 [email protected] gerrit plugin install -n replication.jar - <~/temp/replication.jar

报错:
fatal: remote installation is disabled

解决方法:Open YOUR_GERRIT_DIR/etc/gerrit.config file and add the following entry:

[plugins]
    allowRemoteAdmin = true
执行完成后或可执行:ssh ha gerrit plugin install -n replication.jar - <~/temp/replication.jar
ssh ha gerrit plugin ls
ssh -p 29418 [email protected] gerrit plugin ls
Name                           Version    Status   File
-------------------------------------------------------------------------------
replication                    v2.8       ENABLED  replication.jar




2.配置ssh config

cd ~/.ssh/
vim config
Host 10.27.97.39
        User admin
        IdentityFile ~/.ssh/admin
        StrictHostKeyChecking no
        UserKnownHostsFile /dev/null


3.替换gitlab lubase(project owner) ssh key
cd ~/.ssh/
rm id_rsa
rm id_rsa.pub
vim id_rsa
(粘贴owner的id_rsa)
vim id_rsa.pub
(粘贴owner的id_rsa.pub)
chmod 600 id_rsa
chmod 644 id_rsa.pub

4.加入gitlab pubkey到kown_hosts
sh -c "ssh-keyscan -t rsa gitlab.***.cn >> ~/.ssh/known_hosts"
sh -c "ssh-keygen -H -f ~/.ssh/known_hosts"


5.配置replication.config

[remote "gitlab.***.cn"]
        url = [email protected]***.cn:mobile/${name}.git
        push = +refs/heads/*:refs/heads/*
        push = +refs/tags/*:refs/tags/*
        push = +refs/changes/*:refs/changes/*
        timtout = 30
        threads = 3

6.启动replication

~/gerrit_code/bin/gerrit.sh restart
ssh -p 29418 [email protected] gerrit plugin reload replication
ssh -p 29418 [email protected] replication start ***

以上是关于gerrit 同步gitlab的主要内容,如果未能解决你的问题,请参考以下文章

gerrit 同步gitlab

gitlab同步AD中的组

gerrit用户管理及权限配置

Gitlab+Gerrit+Ldap+nginx+mysql 之Gerrit搭建与配置

Gitlab+Gerrit+Ldap+nginx+mysql 之 Gerrit 操作流程

Gerrit安装及复制到Gitlab