管理员登录打开Admin Area

如何配置Gitlab的双因子验证(Two-Factor Authentication)

进入Settings --》 General

如何配置Gitlab的双因子验证(Two-Factor Authentication) 

Sign-in restrictions启用强制所有用户启用双因子验证(下面48小时表示给的缓冲时间让用户去设置双因子)

 如何配置Gitlab的双因子验证(Two-Factor Authentication)

下面以管理员自己设置双因子为例,点击右上角用户图标-->Settings 

如何配置Gitlab的双因子验证(Two-Factor Authentication)

点击Accout,可以看到右侧有一个二维码 

如何配置Gitlab的双因子验证(Two-Factor Authentication)

用你的手机下载 FreeOTP (安卓)或 Google Authenticator(iphone) 

 这里我用Google Authenticator做示例 

如何配置Gitlab的双因子验证(Two-Factor Authentication)

手机打开Authenticator

如何配置Gitlab的双因子验证(Two-Factor Authentication)

点击扫描条形码扫描上面页面的二维码,本质上是基于时间的随机算法

扫描后手机会显示随机码,每30秒会自动变化一次(有点像中国银行的U盾)

如何配置Gitlab的双因子验证(Two-Factor Authentication)

将随机码填入到Pin Code下方输入框,提交

注:如果提示invalid code,应该是Gitlab所在的系统的时间不精准,需要配置ntp服务与网络时间服务器同步

如果验证成功,则会出现如下页面,会显示几串码,这是recovery code,用于当你丢失手机后可用于

来恢复访问账号,可以点击Download Codes把这些码保存到安全的地方

如何配置Gitlab的双因子验证(Two-Factor Authentication)

 退出系统,重新登录后会弹出如下框,此时可以把手机上authenticator当前的随机码输入进去即可

如何配置Gitlab的双因子验证(Two-Factor Authentication)

 

 

启用双因子认证后,git clone/pull/push代码需要使用access token作为密码

 如何配置Gitlab的双因子验证(Two-Factor Authentication)

 勾选read_repository, write_repository

 

如何配置Gitlab的双因子验证(Two-Factor Authentication)

如何配置Gitlab的双因子验证(Two-Factor Authentication) 

之后使用git clone时用户名不变,密码则输入上图生成的access token.

相关文章:

  • 2021-06-08
  • 2021-09-22
  • 2022-12-23
  • 2021-07-31
  • 2021-04-28
  • 2022-12-23
  • 2022-12-23
  • 2021-08-27
猜你喜欢
  • 2022-12-23
  • 2021-08-07
  • 2021-09-28
  • 2022-12-23
  • 2023-04-07
  • 2021-05-23
  • 2022-12-23
相关资源
相似解决方案