Deploy via TeamCity from GitHub

+2 votes
asked Jul 8, 2015 by jquery-mobile

I am new to using TeamCity. I am trying to figure out how to build code from my private GitHub repository. In an attempt to do this, I did the following.

Created the Deployment Key

  1. Created a new SSH key using PuttyGen.
  2. Gave the key a passphrase.
  3. Saved the private key as "private.ppk".
  4. Saved the public key as "".
  5. Exported the key in OpenSSH format as "key.ssh" using Conversions -> Export OpenSSH key.

Added the Deployment Key to GitHub

  1. When to project repo (i.e.
  2. Clicked "Settings"
  3. Clicked "Deploy Keys"
  4. Clicked "Add Deploy Key"
  5. In "Add Deploy Key", entered "TeamCity" as the title, and copied and pasted the public key from PuTTYGen into the "Key" field.

Created my Project in TeamCity

  1. Type of VCS: Git
  2. VCS root name: "Project master"
  3. VCS root id: "Project_Master"
  4. Fetch URL: "git://
  5. Default Branch: "refs/heads/master"
  6. Authentication Method: "Uploaded Key"
  7. Username: "git"
  8. Uploaded Key: "key.ssh" (uploaded earlier)
  9. Passphrase:

When I click "Test connection", I receive an error. The error is:

Test connection failed in <ProjectName> :: <BuildName>
Incorrect url git://<username>/<repo-name>.git: anonymous git url should not contain a username

If I remove the "Username" field, I get the same error. If I change the Fetch URL to be the url listed in GitHub (, I get an error that says:

Test connection failed in <ProjectName> :: <BuildName>
List remote refs failed: org.eclipse.jgit.errors.TransportException:<username>/<repo-name>.git: not authorized

What am I doing wrong?

1 Answer

+3 votes
answered Jul 8, 2015 by alblue

You need to ensure the public key is uploaded to GitHub and then use the private key in your TeamCity instance. In addition, the SSH key is only use when using the ssh: protocol to GitHub, not the https: protocol.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter