TeamCity failed to connect to GitLab
Answered
I am migrating my repository from GitHub to GitLab. TeamCity checked out the source on GitHub with uploaded key and it worked fine. Now I add the same public key to GitLab repository's deploy deys, but TeamCity fails to connect to it. The "Test connection" show a dialog reading:
List remote refs failed: com.jcraft.jsch.JSchException: Auth fail
I try cloning the GitLab repository with the private key uploaded to TeamCity and it works.
So why does TeamCity fail to connect?
Please sign in to leave a comment.
Hi, by any chance do you have a username populated in GitLab VCS Root configuration? If so, please try removing the value from this setting and leave only private key filled. I believe GitLab doesn't expect a username with keys pair - it only requires a matching private key for a public key configured on its side. Removal of username setting might resolve your issue.
No, removing prefixed username doesn't work. I fill the "Fetch URL" field with:
gitlab.com:my-username/my-repo-name.git
But it still complains "Auth fail". By the way, the "Username" field is always left empty.
Hi, your "Fetch URL" should be git@gitlab.com:my-username/my-repo-name.git. Please make sure git@ is present at the beginning of the line, this allows TeamCity to understand that it should be using SSH.
And "Username" parameter of your VCS root settings should be left blank:
Actually this is what I've tried at very first. I used "git@gitlab.com:my-username/my-repo-name.git" in "Fetch URL" and left empty in "Username", and then get "List remote refs failed: com.jcraft.jsch.JSchException: Auth fail".
This weekend I got an update message for TeamCity, but the issue remained after I updated :(