Skip to end of metadata
Go to start of metadata

If you have an organization account in GitHubGitHub Enterprise or Bitbucket Cloud, you can connect TeamCity to these source code hosting services making it easier for the organization users to create new projects, Git or Mercurial VCS roots, GitHub or Bitbucket issue tracker, which are now now supported out of the box.

Since TeamCity 2017.1, it is possible to connect TeamCity to Visual Studio Team Services making it really simple to set up projects which use VSTS repositories or issue tracker.

On this page:

Configuring Connections

Connections are created on the project level, a configured connection is accessible in the current project and in all of its subprojects. If you use global VCS hosting services like GitHub or Bitbucket Cloud, it makes sense to configure a single connection for the Root project. Or your organization administrator can create a parent project and a configure connection to GitHub there once, and the users will see a list of GitHub repositories URLs in the TeamCity Web UI, which will make setting up subprojects a lot simpler for them.  

Connections are configured on the Project AdministrationConnections page. 

You need to register your TeamCity application in your VCS hosting service using the information provided by TeamCity, enter the access details provided by the service in the TeamCity form, and log in to your VCS hosting service from TeamCity to authorize the TeamCity application in the VCS. See details below.

Connecting to GitHub

You need to configure a connection to your GitHub repository to create project from URL, create VCS root from URL, create a Git VCS root or create GitHub issue tracker.

To configure a GitHub connection:

  1. On the Project Administration page, use the Connections menu item and click the Add Connection button. 
  2. Select GitHub as the connection type.
    The page that opens provides the parameters to be used when registering your TeamCity application in GitHub service.
  3. Click the register application link. The GitHub page opens.
    You need to register TeamCity as an OAuth application in GitHub.The following steps are performed in your GitHub account:
    1. Log into your GitHub account. On the Register a new OAuth application page specify the name and an optional description, the homepage URL and the callback URL as provided by TeamCity.
    2. Click Register application.  The page is updated with Client ID and the client secret information for your TeamCity application. 
  4. Continue configuring the connection in TeamCity: on the Add Connection page that is open, specify the Client ID and the client secret.
  5. Save your settings. 
  6. The connection is configured, and now a small GitHub icon becomes active in several places where a repository URL can be specified: create project from URL, create VCS root from URL, create Git VCS root, create GitHub issue tracker. Click the icon, log in to GitHub and authorize TeamCity. The authorized application will be granted full control of private repositories and the Write repository hooks permission.

Connecting to Bitbucket

You need to configure a connection to your public Bitbucket repository to create project from URL, create VCS root from URL, create Mercurial VCS root, or create a Bitbucket issue tracker.

To configure a Bitbucket connection:

  1. On the Project Administration page, use the Connections menu item and click the Add Connection button.
  2. Select Bitbucket as the connection type.
    The page that opens provides the parameters to be used when registering an OAuth consumer on Bitbucket Cloud. Click the register application link.
    You need to create an OAuth consumer on Bitbucket Cloud. The following steps are performed in your Bitbucket account:
    1. Log into your Bitbucket account, click your avatar and select Bitbucket settings from the menu. The Account page appears.
    2. Click OAuth from the menu bar. On the Add OAuth consumer page specify the name and an optional description, the callback URL and the URL as provided by TeamCity.
    3. Specify the set of permissions: TeamCity requires "read" access to your account and your repositories.
    4. Save your settings.
    5. On the page that opens, in the OAth consumers section, click the name of your TeamCity application to display the key and the secret.
  3. Continue configuring the connection in TeamCity: on the Add Connection page that is open, specify the key and secret.
  4. Save your settings. 
  5. The connection is configured, and now a small Bitbucket icon becomes active in several places where a repository URL can be specified: create project from URL, create VCS root from URL, create Mercurial VCS root, create Bitbucket issue tracker. Click the icon, log in to Bitbucket  and authorize TeamCity. TeamCity will be granted access to your public repositories. For private repositories you'll still have to sign in to Bitbucket as it doesn't provide non-expiring access tokens. See the related discussion.

Connecting to Visual Studio Team Services

Since TeamCity 2017.1, you can configure a connection to your Visual Studio Team Services to create project from URL, create VCS root from URL, create TFS VCS root, or create Team Foundation Work Items tracker.

To configure a connection to Visual Studio Team Services:

  1. On the Project Administration page, use the Connections menu item and click the Add Connection button. 
  2. Select Visual Studio Team Services as the connection type.
     The page that opens provides the parameters to be used when connecting TeamCity to Visual Studio Team Services.
  3. Log in to your Visual Studio Team Services account to create a personal access token with All scopes as described in the Microsoft documentation.

  4. Continue configuring the connection in TeamCity: on the Add Connection page that is open, specify
    - the server URL in the  https://{account}.visualstudio.com format or  your Team Foundation Server web portal as  https://{server}:8080/tfs/.
    - your personal access token.
  5. Save your settings. 
  6. The connection is configured, and now a small Visual Studio Team Services icon becomes active in several places where a repository URL can be specified: create project from URL, create VCS root from URL, create TFS VCS root, create Team Foundation Work Items tracker. Click the icon, log in to Visual Studio Team Services and authorize TeamCity. TeamCity will be granted full access to all of the resources that are available to you.
    Since TeamCity 2017.2 EAP1, when configuring Commit Status Publisher for Git repositories hosted in TFS/VSTS, the personal access token can be filled out automatically if a VSTS project connection is configured.

    Icon

     It is possible to configure several VSTS connections. In this case the server URL will be displayed next to the VSTS icon to distinguish the server in use. 


Creating Entities from URL in TeamCity

Now creating entities from a URL in TeamCity is extremely easy:  on clicking the GitHub, Bitbucket or VSTS icon, the list of repositories available to the current user is displayed (note that only public Bitbucket repositories will be available via the configured connection):

You can select the URL and proceed with the configuration.

  • No labels