gitlab/gerrit/jenkins 集成

参考:

http://blog.csdn.net/stwstw0123/article/details/47615535

当replication gerrit的提交到gitlab时出现下面错误:

[2016-08-01 16:20:44,439] [41c60ca4] Cannot replicate to ssh://[email protected]:10022/test-group/proj1.git
org.eclipse.jgit.errors.TransportException: ssh://[email protected]:10022/test-group/proj1.git: HostKey has been changed: [172.16.2.94]:10022

原因是执行下面的命令时没有带-p port_number

$ sudo -u gerrit2 -H sh -c "ssh-keyscan -t rsa 172.16.2.94 >> /home/gerrit2/.ssh/known_hosts"
$ sudo -u gerrit2 -H sh -c "ssh-keygen -H -f /home/gerrit2/.ssh/known_hosts"

如果你的gitlab的不是默认的8080端口的话,在执行以上命令时请带上-p 10022端口号。

ssh-keyscan -p 10022 -t rsa 172.16.2.94 >> ~/.ssh/known_hosts

reject HostKey

vi ~/.ssh/config

Host mirror
    User gerrit
    IdentityFile  /home/gerrit2/.ssh/id_rsa
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null