为Github CI配置Jenkins w/2FA

Eri*_* H. 7 github jenkins two-factor-authentication

我的Github帐户启用了两个因子授权(2fa).我想将Jenkins与我的一些私有存储库集成,但我无法授权它们因为我启用了2fa.请注意,这是一个多分支管道项目.

任何想法如何配置Jenkins连接私有repos而不创建没有启用2fa的虚拟帐户? 在此输入图像描述

Eri*_* H. 17

谁会想到点击帮助按钮?

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"
Run Code Online (Sandbox Code Playgroud)

即使用Jenkins凭证的用户名/密码时,使用Github个人访问令牌作为密码.

  • 使用访问令牌而不是密码不起作用. (2认同)
  • 编辑:个人访问令牌可以工作。但是,如果您通过在GH中双击来选择令牌,它将在令牌的前面添加一个“空格”。确保您没有无意间选择空格! (2认同)
  • 多分支管道项目不允许您使用个人令牌设置GitHub源。它强制您选择帐户/密码。如果您的帐户启用了2fa,则无法连接到GitHub存储库。 (2认同)