Git providers

Creating an account with Codefresh using one of the supported Git providers (Github, Gitlab, Bitbucket) gives you immediate access to the repositories of the linked provider.

You can add repositories from the other git providers regardless of the one that you used for sign-up. For example, you can use Gitlab to signup with Codefresh, but still build repositories that exist in Bitbucket.

You can even add multiple accounts from each Git provider (if you have more than one) allowing you to use Codefresh as a central CI/CD solution that can access all your git repositories regardless of the backing git provider.

Currently Codefresh supports:

  • Github Cloud
  • Github On premises
  • Bitbucket
  • Gitlab Cloud
  • Gitlab On premises
  • Azure DevOps Git
  • Atlassian Stash (old version of Bibucket Server)
  • Bitbucket Server (new version of Stash)

Atlassian Stash/Bitbucket server as well as the on-premise version of Gitlab and Github are only available to Codefresh enterprise customers.

Adding more GIT providers to your Codefresh account.

By default, you have direct access to git repositories that exist in the GIT provider that you used while signing up for Codefresh. You can easily create Codefresh projects that checkout code from that GIT provider without any extra configurations.

To add additional GIT providers go to your Account Configuration, by clicking on Account Settings on the left sidebar. On the first section called Integrations click the Configure button next to Git providers.

Codefresh Account Integration

You can add a new git provider using the Add Git provider drop-down.

Add GIT provider

Add GIT provider

For each git provider you need to setup authentication, so Codefresh can get access to the public and private repositories of the respective platform.

The easiest way to setup authentication is with OAuth2 if supported by the git provider. You only need to name your integration and Codefresh will automatically set it up once you accept the permissions required. If you have problems with OAuth2 or the provider does not support it, you need to manually create credentials by yourself in your git account and then enter them into Codefresh.

In the case of an on-premise GIT provider you also need to fill in the URL where the provider is installed.

Github

For the OAuth2 method you only need to decide on public/private repository access, enter a name for your connection and click Save. Then accept the permissions dialog. This is the easiest and recommended way to integrate Github. Notice that if you used Github when you created your Codefresh account, this integration is already setup for you.

For the Access Token method you need:

  • a friendly name for the git context. It can be anything you want
  • an access token

To create an access token, go to your Github settings and select the Developer settings option from the left sidebar. The select Personal access tokens from the left menu. For more information see the Github Documentation page

The “token description” you enter in your Github account in order to create the token is completely arbitrary (use “Codefresh” for an example). Once you have the token, paste it in the Codefresh UI and click Test connection. If everything is OK you can now save the git integration.

The minimum permissions for the token are:

  • repo.*
  • admin:repo_hook.*

Github permissions

Github permissions

For Github on-premise you also need to provide the URL of the GitHub server in your organization.

Gitlab

For the OAuth2 method you only need to enable private repository access, enter a name for your connection and click Save. Then accept the permissions dialog. This is the easiest and recommended way to integrate Gitlab. Notice that if you used Gitlab when you created your Codefresh account, this integration is already setup for you.

For the Access Key method you need:

  • a friendly name for the git context. It can be anything you want
  • an access token/key

To create an access token, go to your Gitlab settings and select the Access tokens options. For more information see the Gitlab Documentation page

The name you enter in order to create the token in the Gitlab UI is completely arbitrary (use “Codefresh” for an example)

Once you have the token, paste it in the Codefresh UI and click Test connection. If everything is OK can now save the git integration.

For Gitlab on-premise you also need to provide the URL of the Gitlab server in your organization.

Bitbucket

For the OAuth2 method you only need to enter a name for your connection and click Save. Then accept the permissions dialog. This is the easiest and recommended way to integrate Bitbucket. Notice that if you used Bitbucket when you created your Codefresh account, this integration is already setup for you.

For the Application Password method you need:

  • a friendly name for the git context. It can be anything you want
  • the name of your Bitbucket account/email address
  • A Bitbucket application password.

To create an application password go to your Bitbucket settings and select App passwords from the sidebar. Click the button to create one. For more information see the Bitbucket Documentation page

The minimum permissions needed by Codefresh are shown below.

Bitbucket permissions

Bitbucket permissions

The “label” you enter in your Bitbucket account in order to create the application password is completely arbitrary (use “Codefresh” for an example). Once you have the token, paste it in the Codefresh UI and click Test connection. If everything is OK you can now save the git integration.

Azure DevOps

For Azure you need to create a personal access token. Sign in your Azure Devops account and click on your profile icon on the top right corner. Then select Security:

Azure DevOps Security

Azure DevOps Security

On the screen that will appear click the New token Button. Enter an arbitraty name for the token and select the correct Organization from the drop down menu. Remember your organization name as you will use it later in the Codefresh side. Select an expiration date for your token

At the time of writing Azure DevOps does not have the option to create a token that is valid for ever. Choose a large time period and make sure that you have a policy in place for re-newing your tokens so that Codefresh can continue to read your git repo.

Azure DevOps Token

Azure DevOps Token

From the Scope section choose the option Show all scopes and choose the following

  • Code - Read
  • Code - Status
  • Graph - Read
  • Project and Team - Read
  • User profile - Read

Finally click the Create button and copy your token (it will never be shown again).

Then at the Codefresh configuration enter your organization name and your token.

Codefresh integration with Azure Devops

Codefresh integration with Azure Devops

Click on Test connection to verify your settings and finally click save. Now you can create pipelines that use Azure DevOps Git repos.

Codefresh integration with Azure Devops

Codefresh integration with Azure Devops

Your Azure DevOps repositories will be available when creating a new project in Codefresh.

Atlassian Stash

Atlassian stash is only available for an on-premise connection. Follow the same instructions as Bitbucket. You also need to provide the URL of the Stash server in your organization.

This option is only for Atlassian stash until version 3.10 which is the old version. It was then renamed to Bitbucket server.

Bitbucket Server

Bitbucket server is the new and current name of Atlassian Stash. Again, it is only available for an on-premise installation.

Codefresh supports Bitbucket server versions 5.4.0+ since those expose the API used by the integration.

Using your git provider

Once your provider is active, you can add a new project into Codefresh and then during the repository selection screen you will have access to the additional git providers.

Select GIT provider

Select GIT provider

Notice that for all supported Git providers Codefresh will automatically create all the webhooks needed for triggering pipelines when a commit (or other event) happens.

After adding the repository Codefresh will behave exactly the same, regardless of the selected git provider. You will be able to create pipelines for different git providers in exactly the same manner.