Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure Jenkins For Github CI w/ 2FA

My Github account has two factor authorization (2fa) enabled. I want to integrate Jenkins with a few of my private repositories, but I cannot authorize them because I have 2fa enabled. Note this is a multibranch pipeline project.

Any ideas how to configure Jenkins to connect with private repos without creating a dummy account that does not have 2fa enabled? enter image description here

like image 801
Eric H. Avatar asked May 02 '17 20:05

Eric H.


People also ask

How do I enable 2FA on GitHub?

In the upper-right corner of any page, click your profile photo, then click Settings. In the "Access" section of the sidebar, click Password and authentication. Under "Two-factor authentication", click Enable two-factor authentication. Under "Two-factor authentication", select Set up using an app and click Continue.

Does Jenkins support MFA?

Secure Jenkins Login with Two-Factor Authentication (2FA/MFA). Supported methods are Google Authenticator, Security Question, OTP over email, Hardware token, etc. You can access your account through backup methods like security questions in case authenticator device is not accessible, stolen or hacked.

Does GitHub require 2 factor authentication?

GitHub, the code hosting platform used by tens of millions of software developers around the world, announced today that all users who upload code to the site will need to enable one or more forms of two-factor authentication (2FA) by the end of 2023 in order to continue using the platform.


1 Answers

Whoever would have thought to click the help button?

Credentials used to scan branches and pull requests, check out sources and mark commit statuses.

If none is given, only the public repositories will be scanned, and commit status will not be set on GitHub.

If your organization contains private repositories, then you need to specify a credential from an user who have access to those repositories.
This is done by creating a "username with password" credential where the password is GitHub personal access tokens. The necessary scope is "repo"

ie use a Github personal access token as your password when using username/password for your Jenkins credential.

like image 126
Eric H. Avatar answered Sep 18 '22 10:09

Eric H.