refer to:
http://blog.csdn.net/stwstw0123/article/details/47615535
When the replication gerrit commits to gitlab, the following error occurs:
[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
The reason is that the following command is executed without -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"
If your gitlab is not the default port 8080, please bring the -p 10022 port number when executing the above command.
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