配置Gerrit到Gitlab的自动同步
说明:配置Gerrit的replication插件,把库文件自动同步到Gitlab。在安装gerrit是需要开启replication插件功能。服务器注明Gerrit 192.168.1.10 安装目录 /home/gerrit/Gitlab 192.168.1.121. 在gerrit上生成密钥 (r...
作者: 维特网络
分类: 技术分享
时间: 2022-11-21 09:49
阅读量: 270 次
说明:配置Gerrit的replication插件,把库文件自动同步到Gitlab。在安装gerrit是需要开启replication插件功能。
服务器注明
Gerrit 192.168.1.10 安装目录 /home/gerrit/
Gitlab 192.168.1.12
1. 在gerrit上生成密钥 (root用户登入)
ssh-keygen -t rsa -C "gerrit@gerrit.com" #邮箱随意设置
当前用户的.ssh目录下会生成id_rsa,id_rsa.pub,复制id_rsa.pub的内容,添加到Gitlab管理员root账号的sshkey中。
2. 把gitlab服务器添加到“已知主机”
输入指令并生成 ~/.ssh/known_hosts文件
ssh-keyscan -t rsa 192.168.1.12 >> ~/.ssh/known_hosts
3. 创建文件 ~/.ssh/config
并输入如下内容
Host 192.168.1.12 IdentityFile ~/.ssh/id_rsa PreferredAuthentications publickey
4. 创建文件/home/gerrit/etc/replication.config
并输入如下内容
[remote "gitlab"]
url = git@192.168.1.12:root/${name}.git
push = +refs/heads/*:refs/heads/*
push = +refs/tags/*:refs/tags/*
push = +refs/changes/*:refs/changes/*
threads = 3
5. 重启gerrit
/home/gerrit/bin/gerrit.sh restart
在gerrit上创建库,然后把源码等文件push到gerrit库,会自动同步到gitlab上
相关文章
维特网络是西部数码产品的钻石代理商
2025-10-15
了解详情
Centos 7安装gitlab-ce-11.6.9
2022-01-01
了解详情
Ubuntu 18.04安装gerrit 3.0.3
2021-12-27
了解详情
数据中心和IT设施的优先事项
2019-07-01
了解详情
企业布线趋势和新的测试注意事项
2019-05-01
了解详情