Configure & deploy site /Git /

Self-hosted Git

This feature is available on Enterprise plans.

You can connect your Netlify team to your instance of GitHub Enterprise Server, GitLab self-managed, or Bitbucket Data Center and Server to make linking sites to repositories easier.

Supported Git instances

You can connect repositories from your Git provider instance to the Netlify UI in the following ways:

After selecting GitHub when creating a new site for example, you’ll be able to choose between GitHub.com or your self-hosted instance.

Beyond simplifying the initial configuration of continuous deployment, Netlify’s self-hosted Git feature offers several long-term advantages over manual setup using Netlify CLI, including:

# Connect a Netlify team to your Git provider instance

Self-hosted Git information and settings are found under

.

The default state indicates that self-managed instances are "Not connected."

Connecting your Netlify team to your self-hosted GitHub, GitLab, or Bitbucket instance requires setup on both Netlify and your self-hosted Git instance. The configuration steps vary by Git provider. Read the general requirements and limitations below before you get started with the provider-specific sections.

# Requirements

  • Instance availability. Our build process must be able to contact your self-hosted Git instance. If your self-hosted Git instance is behind a VPN/firewall, enable Private Connectivity and allowlist the private network IP address.
  • Team member roles. You must be a Team Owner to connect your Netlify team to your self-hosted Git instance. After an Owner sets up the connection, any Team Owner or Developer can select the self-hosted instance when choosing the Git provider where a site’s source code is hosted.
  • Site repository available at a public URL. Netlify sites can only connect to GitHub Enterprise Server or GitLab self-managed repositories that are available at a public URL. This is not a requirement for Bitbucket Data Center and Server. On your Git provider instance, you can configure a single organization or project to allow public repositories.

# Limitations

  • Site transfer. Because sites linked to self-hosted repositories rely on a team-level connection to the self-hosted Git instance, you cannot transfer a site between teams if the site is linked to a self-hosted repo. You can contact Support for assistance with transferring sites linked to self-hosted repos.
  • Number of connections. You can connect your Netlify team to instances of GitHub Enterprise Server, GitLab self-managed, and Bitbucket Data Center and Server, but you cannot connect your team to multiple self-hosted instances of the same Git provider. A GitHub Enterprise Server instance can be connected to only one Netlify team.
  • Sensitive variable policy. Because self-hosted instances enable a higher degree of access control, we treat all self-hosted repositories as private. This means you won’t be able to set a sensitive variable policy for a site linked to a self-hosted repo.
  • Deploy to Netlify button. You cannot create a Deploy to Netlify button for a self-hosted repo.
  • Git Gateway. Self-hosted repositories on an instance of GitHub Enterprise Server, GitLab self-managed, or Bitbucket Data Center and Server are not supported with Git Gateway. You must have a repository available on GitHub.com, GitLab.com, or Bitbucket.org.
  • Private repositories for GitHub or GitLab. Netlify sites can only connect to GitHub Enterprise Server and GitLab self-managed repositories that are available at a public URL. This is not a requirement for Bitbucket Data Center and Server. On your Git provider instance, you can configure a single project or organization to allow public repositories.

# Provider-specific setup instructions

Choose your Git provider for your self-hosted instance:

# Bitbucket Data Center and Server

Make sure you’ve read the general requirements and limitations above before you proceed with this Bitbucket-specific section.

# Requirements

  • Self-hosted Bitbucket instance. You can use Bitbucket Data Center or Bitbucket Server hosted either on premises or in the cloud.

# Setup

To connect your Netlify team to Bitbucket Data Center and Server, you will need to create a Bitbucket OAuth application on your self-hosted instance and then provide us details about your instance and app.

# Create OAuth application

Follow the instructions to create an incoming application link to your Bitbucket instance.

Use the following values for configuration:

  • Name: Netlify

  • Redirect URL: https://api.netlify.com/auth/done

  • Application Permissions:

    • Projects: Admin

    • Repositories: Read, Write, Admin

    • Account: Write

Configuration modal for a Bitbucket application link with recommended entries and selections.

After you create your incoming application link, Bitbucket will provide you with a Client ID and Client secret. You’ll need to give these to Netlify in the next part of the setup.

# Connect to Bitbucket Data Center and Server from Netlify

  1. Go to , select Edit settings, then select Connect for Bitbucket Data Center and Server. This will open a configuration modal that contains a form to provide us the necessary details about your instance and app.
  2. Provide the following details about your Bitbucket instance and OAuth application:
    • Instance URL: URL where your self-hosted Bitbucket instance can be accessed.
    • Clone URL: URL where your self-hosted Bitbucket instance repositories can be cloned (if different than your Instance URL).
    • Application ID and Secret: values that are assigned to your OAuth application by Bitbucket and can be found in your application link‘s OAuth credentials under Client ID and Client secret. These will be used to authenticate requests made by Netlify to your self-hosted Bitbucket instance.
  3. Select Save.

After you complete the setup for Bitbucket Data Center and Server, your Netlify team will be able to select your self-hosted instance when importing an existing project or when changing the linked repository on an existing site.

# Troubleshooting

Here are steps to address issues that you may encounter using Bitbucket Data Center and Server with Netlify.

# If you’re having trouble saving your Bitbucket Data Center and Server settings in Netlify

  • Verify that your self-hosted Bitbucket instance is accessible outside of your VPN/firewall or that you’ve updated your VPN/firewall allowlists for Private Connectivity.
  • Verify that the Application ID and Secret match the Client ID and Client secret values assigned by Bitbucket to your OAuth application. These can be found in your application link’s credentials details.

# If you need to change your Bitbucket Data Center and Server settings on Netlify

  • You’ll have to delete the old connection and create a new one. This is to protect the sensitive values in the settings.

  • To delete the old connection, go to

    , select Edit settings, and then use the x button next to your self-hosted Bitbucket instance.

# If Bitbucket serves an authorization error saying The redirect URI included is not valid

  • Verify that your Bitbucket OAuth application has Redirect URI set to https://api.netlify.com/auth/done.

# If Netlify serves an authorization error saying No Auth Provider Found

  • Your Bitbucket OAuth application link may have been changed. You won’t be able to compare your Bitbucket Data Center and Server settings on Netlify to your OAuth application’s current state since you can’t edit the Netlify Self-hosted Git settings once saved. You can delete the old connection as described above and create a new one to make sure you’re matching the current state of your Bitbucket OAuth application link.

# If you’re having trouble linking your sites to your self-hosted repositories

  • Your Bitbucket Data Center and Server instance may have become inaccessible. Verify that your instance is accessible outside of your VPN/firewall or that you’ve updated your VPN/firewall allowlists for Private Connectivity.