JQuery Mobile
JQuery Mobile

Reputation: 6301

Deploy via TeamCity from GitHub

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 "public.pub".
  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. https://github.com//)
  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://github.com//.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://[email protected]/<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 (https://github.com//.git), I get an error that says:

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

What am I doing wrong?

Upvotes: 2

Views: 880

Answers (1)

AlBlue
AlBlue

Reputation: 24040

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.

Upvotes: 3

Related Questions