su - gitlab-psql
psql -h /var/opt/gitlab/postgresql -d gitlabhq_production
SELECT name,username,otp_required_for_login,two_factor_grace_period, require_two_factor_authentication_from_group FROM users;
UPDATE users set require_two_factor_authentication_from_group = 'f' WHERE username = 'root';
重新登录gitlab的web查看,双因子认证没有了,可以正常使用了。
注意:双因子认证是多次输入错误密码登录gitlab时触发的,如果以后登录gitlab时,再多次输入错误,又会开启双因子认证。请记清楚密码,否则上述操作再来一遍。