Two-Factor Authentication (2FA) with GitHub in Bamboo
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
When attempting to authenticate with a GitHub repository that is secured with two-factor authentication (2FA) via HTTPS, you receive the following error in Bamboo:
1
Failed to load data from GitHub.com.atlassian.bamboo.plugins.git.GitHubAccessor$GitHubException: Must specify two-factor authentication OTP code.
Cause
2FA is enabled.
Resolution
To work around 2FA in GitHub you will need to set up a personal access token and use this instead of your password. The steps to do this are as follows:
Go to your Personal Access Tokenssettings in GitHub.
Click on the Generate new token button.
Name the token something descriptive.
Select which scopes you wish to grant this token.
Click the Generate token button.
Copy the token and use it as a password in Linked Repositories.
You can find more information about this on GitHub's help here.
The minimum permissions / scopes required for the Personal Access Token for Bamboo to retrieve the list of repositories and source code from GitHub are as follows:
repo for private (and public) repositories or
public_repo & user to restrict access to just public repositories.
Was this helpful?