1.安装gerrit replication插件
unzip gerrit.war cp WEB-INF/plugins/replication.jar ~/temp/ ssh -p 29418 admin@172.19.16.64 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 admin@172.19.16.64 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 = git@gitlab.***.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 ha gerrit plugin reload replication ssh ha replication start ***