Git in TeamCity: Unable to load identity file - public SSH key

I've been spending hours trying every combination to get git work with TeamCity.  I'm working with a team that has their own github instance- git@git.x.com.  When trying to authenticate agains the server, I'm getting this error:

Unable to collect changes: jetbrains.buildServer.vcs.VcsException: Problem collecting changes for 'PROJECTX' : Repository 'jbalfantz@git.x.com:jbalfantz/gitprojectname.git': Unable to load identity file: c:\temp\id_rsa.pub (passphrase protected)

I'm able to clone directly from the github server using the ssh key.  I've copied it to 5 different places to make sure it's not a permissions issue accessing the id_rsa.pub key.

They key was generated following these instructions:  https://help.github.com/articles/generating-ssh-keys (ssh-keygen-t rsa -C "jbalfantz@yp.com").  

The TeamCity setup:

Type of VCS:  Git
Fetch URL:  jbalfantz@git.x.com:jbalfantz/gitprojectname.git
Authentication Method:  Private Key
User name:  (blank)
Private Key Path:  c:\temp\id_rsa.pub


I've tried variations of the location of the id_rsa.pub file.  I've tried other Authentication methods:  1) Anonymous (not supported by server), 2) Default Private Key (List remote refs failed: org.eclipse.jgit.errors.UnsupportedCredentialItem: ssh://jbalfantz@git.x.com:22: Password for jbalfantz@git.x.com ), and 3) Password (Test connection failed in Platform Tools :: Deploy-Git. Connection test failed: com.jcraft.jsch.JSchException: Auth fail)

Running out of options.  I've seen where users used PuttyGen to generate their key, but it appears that ssh-keygen is the supported key generator.

5 comments
Comment actions Permalink

Hi

Do you use server-side or agent-side checkout mode?

0
Comment actions Permalink

VCS checkout mode:  Automatically on agent (if supported by VCS roots).

Just to eliminate potential problems, I've given it a local checkout directory as well.  

0
Comment actions Permalink

I would generate a key which does not include a passphrase and use this first as i believe your problem is probably that you need to enter the pass phrase to continue.  We have the same setup as you and are able to pull changes from github using a key which has no passphrase.  I would also check that you have added the SSH key to a user for that GitHub repository

0
Comment actions Permalink

If you've got it working, what "Authentication Method" are you using?  I've created a key without a passphrase and added the key to our github instance.  I'm getting this error testing the Private Key option:

Test connection failed in Test-Project. Repository 'jbalfantz@git.x.com:jbalfantz/Test.git': Unable to load identity file: c:\temp\id_rsa.pub


The account name on the github is jbalfantz, the email on the ssh key is "TeamName@x.com," and I've tried the username as both jbalfantz and (blank).  I'd like to copy your settings since they've worked for you, so I have a working example I can build towards.

0
Comment actions Permalink

We use the User name style of UserId (jsmith) and the Authentication method of Default Private key with a blank user name entry.

The key files and the config file are in the ~\.ssh\ folder and I tested the connection using the instructions in step 5 of https://help.github.com/articles/generating-ssh-keys first and once that was working I was able to use the agents successfully.

The contents of our config file in the .ssh folder are:

Host github.com
  Hostname ssh.github.com
  Port 443
  StrictHostKeyChecking no



which allows the ssh connection to be tunneled through the firewall on port 443, as our firewall was also blocking it.

Hope this helps.
0

Please sign in to leave a comment.