Repository Mirroring - SSH Host Key verification fails
Summary
I am migrating a private project from GitHub to GitLab. I am setting up Repository Mirroring to push the repo from GitLab to GitHub. Configuring a project to Mirror to ssh://github.com/user/repo.git fails with Host Key Verification failed
Steps to reproduce
Issue is present in both Private and Public repositories. I created a test repository on both GitHub and GitLab to verify the issue.
- [Local] Update local repository to use GitLab instead of GitHub by default:
git remote rename origin old-origin
git remote add origin git@gitlab.com:rokusei/test-mirror.git
git push -u origin --all
git push -u origin --tags
- [GitLab] Configure project to mirror to GitHub and ensure host keys match expected
Settings -> Repository -> Mirroring repositories
Git repository URL: ssh://git@github.com/rokusei/test-mirror.git
Mirror direction: Push
Detect Host Keys -> 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
Authentication method: SSH public key
--> Mirror Repository
- [GitLab] Copy generated SSH public key using
Copy SSH public key
button on sameMirroring repositories
page - [GitHub] Add SSH Key to repository as a Deploy key with write privileges
Settings -> Deploy Keys
Title: gitlab-sync
Key: <pasted from clipboard>
Allow write access: Checked
--> Add Key
- [GitLab] Trigger mirror update
Settings -> Repository -> Mirroring repositories
Under Mirrored repositories (1):
ssh://git@github.com/rokusei/test-mirror.git -> Update Now
- [GitLab] Mirror should fail and a tooltip should show
13:close stream to gitaly-ruby: rpc error: code = Unknown desc = Gitlab::Git::RepositoryMirroring::RemoteError: Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
- [GitHub] Ensure authentication succeeded on GitHub side
Settings -> Deploy Keys
Last used within the last week
Example Project
https://gitlab.com/rokusei/test-mirror/ https://github.com/rokusei/test-mirror/
What is the current bug behavior?
SSH key based mirroring fails. Password works.
What is the expected correct behavior?
Mirroring should succeed with SSH and host keys should be properly validated.
Relevant logs and/or screenshots
Covered in reproduction steps.
Output of checks
This bug happens on GitLab.com
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)