I am trying to connect my jenkins server to my private repository on gitlab.com. I have already added the API access token of gitlab to my jenkins server and added the Jenkins public key to the ssh-keys of gitlab account.
Upon adding my gitlab repository to my jenkins pipeline I get below error:
Failed to connect to repository : Command "git ls-remote -h -- git@gitlab.com:user_name/repo_name.git HEAD" returned status code 128:
stdout:
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.
When I try to run the following command on my Jenkins server:
ssh -T git@gitlab.com:user_name/repo_name.git
I get the following error:
ssh: Could not resolve hostname gitlab.com:user_name/repo_name.git: Name or service not known
I am not able to figure out the reason why my Jenkins server is unable to access the repository even after providing the SSH Keys and the Access Token.