Connect Azure Boards to GitHub
Azure Boards | Azure DevOps Server 2020 | Azure DevOps Server 2019
By connecting your Azure Boards project with GitHub.com repositories, you support linking between GitHub commits and pull requests to work items. You can use GitHub for software development while using Azure Boards to plan and track your work.
When you make the connection from Azure Boards, the list of GitHub repositories correspond to ones that you allow Azure Boards to access. You can limit which repositories Azure Boards can access overall, and limit what a particular project can access or split the management of work across different Azure Boards projects.
By connecting your Azure DevOps Server project with your GitHub Enterprise Server repositories, you support linking between GitHub commits and pull requests to work items. You can use GitHub Enterprise for software development while using Azure Boards to plan and track your work.
Note
Azure Boards and Azure DevOps Services support integration with GitHub.com and GitHub Enterprise Server repositories.
On-premises Azure DevOps Servers support integration with GitHub Enterprise Server repositories.
Prerequisites
- You must connect to an Azure Boards or Azure DevOps project. If you don't have a project yet, create one.
- You must be a member of the Project Administrators group and the project's Contributors group. If you created the project, then you have permissions.
- You must be an administrator or owner of the GitHub repository you'll be connecting to.
Important
You can connect to multiple GitHub repositories so long as you are an administrator for those repositories.
- You must connect to an Azure Boards or Azure DevOps project. If you don't have a project yet, create one.
- You must be a member of the Project Administrators group and the project's Contributors group. If you created the project, then you have permissions.
- You must be an administrator of the GitHub Enterprise Server you'll be connecting to.
Authentication options
Depending on the platform you work from to connect to GitHub, you have a choice of the credentials you use.
Platform | GitHub.com | GitHub Enterprise Server |
---|---|---|
Azure DevOps Services | ||
Azure DevOps Server 2020 Azure DevOps Server 2019 |
|
Add a GitHub connection
Sign into Azure Boards.
Choose (1) Project Settings, choose (2) GitHub connections and then (3) Connect your GitHub account.
If connecting using PAT, see Add a GitHub connection using PAT. If connecting to a GitHub Enterprise Server, see Register Azure DevOps in GitHub as an OAuth App.
If this is your first time connecting to GitHub from Azure Boards, you will be asked to sign in using your GitHub credentials. Choose an account for which you are an administrator for the repositories you want to connect to.
If you have enabled two-factor authentication, enter the authentication code that GitHub sent you and choose Verify.Otherwise, the system will automatically recognize your GitHub organization as your GitHub account has previously been associated with your Azure DevOps Services account.
The Add GitHub Repositories dialog automatically displays and selects all GitHub.com repositories for which you are an administrator. Unselect any repositories that you don't want to participate in the integration.
Tip
We recommend that you only connect a GitHub repo to projects defined in a single Azure DevOps organization. Connecting the same GitHub repo to projects defined in two or more Azure DevOps organizations can lead to unexpected AB# mention linking. For details, see Troubleshoot GitHub & Azure Boards integration.
When done, choose Save.
Review the GitHub page that displays and then choose Approve, Install, & Authorize.
Provide your GitHub password to confirm.
When done, you should see the new connection with the selected repositories listed.
Add a GitHub connection using PAT
We recommend that you use OAuth to connect to your GitHub repository. However, if you need to use a PAT, you can by following these procedures.
Tip
When creating your GitHub PAT, make sure that you include these scopes: repo, read:user, user:email, admin:repo_hook
.
To choose a PAT when connecting a GitHub repository, choose
New Connection and then choose the Click here link.
To create a GitHub PAT, go to GitHub Developer Settings>Personal access tokens.
Enter the PAT and choose Connect.
Register Azure DevOps in GitHub as an OAuth App
If you plan to use OAuth to connect Azure DevOps Services or Azure DevOps Server with your GitHub Enterprise Server, you first need to register the application as an OAuth App. For details, see Creating an OAuth App.
Register Azure DevOps Services
Sign into the web portal for your GitHub Enterprise server.
Open Settings>Developer settings>Oauth Apps and choose New OAuth App.
Fill out the form to register your Azure DevOps Server application.
For the Homepage URL, specify the Organization URL of your organization.
For the Authorization callback URL, use the following pattern to construct the URL.{Azure DevOps Services Organization URL}/_admin/oauth2/callback
For example:
https://dev.azure.com/fabrikam/_admin/oauth2/callback
Choose Register application.
Upon success, you'll see a page that provides the Client ID and Client Secret for your registered OAuth application.
Register Azure DevOps Server
Sign into the web portal for your GitHub Enterprise server.
Open Settings>Developer settings>Oauth Apps and choose New OAuth App.
Fill out the form to register your Azure DevOps Server application.
For the Homepage URL, specify the Public URL of your project collection. You can find this URL by opening the Azure DevOps Administration Console and viewing the Application Tier node.
For the Authorization callback URL, use the following pattern to construct the URL.
{Azure DevOps Server Public Url}/{Collection Name}/_admin/oauth2/callback
For example:
http://contoso/DefaultCollection/_admin/oauth2/callback
Or,
https://tfs.contoso.com/MyCollection/_admin/oauth2/callback
Choose Register application.
Upon success, you'll see a page that provides the Client ID and Client Secret for your registered OAuth application.
Register your OAuth configuration in Azure DevOps Services
Sign into the web portal for Azure DevOps Services.
Add the GitHub Enterprise Oauth configuration to your organization.
Open Organization settings>Oauth configurations, and choose Add Oauth configuration.
Fill in the form that appears, and then choose Create.
Register your OAuth configuration in Azure DevOps Server
Sign into the web portal for your Azure DevOps Server.
Add the GitHub Enterprise Oauth configuration to your Azure DevOps Server collection.
Open Admin settings>Oauth configurations, and choose Add Oauth configuration.
Fill in the form that appears, and then choose Create.
Connect Azure DevOps Services to GitHub Enterprise Server
Important
To connect Azure DevOps Services to your GitHub Enterprise Server, your GitHub Enterprise Server must be sufficiently accessible from the Internet. Make sure Azure DNS can resolve your GitHub Enterprise Server name and your firewall allows access from Azure Data Center IP addresses. To determine the IP address range, see Microsoft Azure Datacenter IP Ranges. A common error message encountered when connectivity issues exist is:
The remote name could not be resolved: 'github-enterprise-server.contoso.com'
If you encounter this error, check that your server is accessible. For more information, see Azure DNS FAQ.
Choose the
Azure DevOps logo to open Projects, and then choose the Azure Boards project you want to configure to connect to your GitHub Enterprise repositories.
Choose (1) Project Settings, choose (2) GitHub connections and then (3) Click here to connect to your GitHub Enterprise organization.
Choose from one of the following options—OAuth, Personal Access Token, Username and Password—based on the credentials you've chosen.
To create a PAT, see Creating a personal access token.
Tip
When creating your GitHub Enterprise Server PAT, make sure that you include these scopes:
repo, admin:repo_hook, read:user, user:email
.Connect using OAuth
Choose the configuration that you set up in Step 4 of Register your OAuth configuration in Azure DevOps Services, and then choose Connect.
Connect using a Personal Access Token
Enter the URL for your GitHub Enterprise server and the Personal access token credentials recognized by that server. And then choose Connect.
Connect using a Username and Password
Enter the URL for your GitHub Enterprise server and the administrator account credentials recognized by that server. And then choose Connect.
The dialog lists all repositories for which you have GitHub administration rights. You can toggle between Mine and All to determine if others appear, and then check the ones that you want to add. Choose Save when done.
Connect Azure DevOps Server to GitHub Enterprise Server
Choose the
Azure DevOps logo to open Projects, and then choose the Azure Boards project you want to configure to connect to your GitHub Enterprise repositories.
Choose (1) Project Settings, choose (2) GitHub connections and then (3) Connect your GitHub Enterprise account.
Or, choose a personal access token or username and password, if you are choosing to make your connection with those credentials.
To create a PAT, see Creating a personal access token.
Tip
When creating your GitHub PAT, make sure that you include these scopes:
repo, admin:repo_hook, read:user, user:email
.Connect using OAuth
Choose the configuration that you set up in Step 4 of Register your OAuth configuration in Azure DevOps Server, and then choose Connect.
Connect using a Personal Access Token
Enter the URL for your GitHub Enterprise server and the Personal access token credentials recognized by that server. And then choose Connect.
Enter the URL for your GitHub Enterprise server and the administrator account credentials recognized by that server. And then choose Connect.
The dialog lists all repositories for which you have GitHub administration rights. You can toggle between Mine and All to determine if others appear, and then check the ones that you want to add. Choose Save when done.
Add or remove repositories, or remove a connection
To add or remove repositories, open the
actions icon for the connection and choose Add repositories or Remove repositories from the menu.
To remove all repositories and the connection, choose the Remove connection option. Then, choose Remove to confirm.
Resolve connection issues
See Troubleshoot GitHub repository connection.