SSH push mirror fails with "Host key verification failed"

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Bug Report

Creating a SSH push mirror with the new auth_method parameter and gitlab_project_mirror_public_key resource results in the following error message:

13:get remote references: create git ls-remote: exit status 128, stderr: " Host key verification failed. fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists. ".

Relevant Terraform Configuration

Mirror URL: ssh://git@github.com/Marcelotsvaz/vaz-projects.git

resource gitlab_project_mirror main {
	project = gitlab_project.main.id
	url = replace( github_repository.main.ssh_clone_url, "/^(.+):(.+)$/", "ssh://$1/$2" )
	auth_method = "ssh_public_key"
}

data gitlab_project_mirror_public_key main {
	project_id = gitlab_project.main.id
	mirror_id = gitlab_project_mirror.main.mirror_id
}

resource github_repository_deploy_key main {
	repository = github_repository.main.name
	title = "GitLab Mirror SSH Key"
	key = data.gitlab_project_mirror_public_key.main.public_key
	read_only = false
}

Additional Details

  • GitLab Terraform Provider Version: 18.0.0
  • OpenTofu Version: v1.9.1
Edited by 🤖 GitLab Bot 🤖