如何在github和2FA中使用Visual Studio代码 [英] How to use visual studio code with github and 2FA

查看:134
本文介绍了如何在github和2FA中使用Visual Studio代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的组织要求我们将2FA添加到github.很遗憾, 现在,我们无法在Visual Studio代码中投入工作. VSCode提示输入用户名和密码.它不知道2FA.

Our organisation required us to add 2FA to github. Unfortunately, now we cant commit our work in visual studio code. VSCode prompts for username and password. It doesnt know about 2FA.

有些非常古老的帖子说要使用个人访问令牌(PAT),例如

There are some very old posts saying to use a personal access token (PAT), e.g.

https://colinmackay.scot/2015/07/15/two-factor-authentication-with-github-and-visual-studio-2013/comment-page-1/#comment-29984

http://www.anilsezer .com/connecting-github-from-visual-studio-after-twofactor-authentication-enabled

但是,这也不起作用.

However, this does not work either.

第一篇文章说,输入PAT作为用户名,并在VSCode github登录对话框中将密码留空.由于您无法输入空白密码,因此无法使用此功能.输入随机密码即可

The first article says enter the PAT as the username and leave the password blank in the VSCode github login dialog. This does not work as you cant sumbmit with a blank password. Entering a random password gives

Fatal: HttpRequestException encountered.
   An error occurred while sending the request.
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
remote: Invalid username or password.
    fatal: Authentication failed for 'https://github.com/xxx/xxx.git/'

第二篇文章说使用您的用户名/电子邮件作为用户名,并输入PAT作为密码.这也是VSCode文档所说的.同样也累了这个问题.

The second article says to use your user/email as the username, and enter the PAT as the password. This is also what the VSCode documentation says. Tired this too, same problem.

有人工作吗?

此外,有人知道VSCode需要哪个作用域"吗?我只是勾选了回购".这可能是问题,需要更多吗?

Also, does anyone know which of the "scopes" is required for VSCode? I just ticked "repo". Could this be the problem, are more required?

推荐答案

我建议您可以使用个人访问令牌. 只需在网站 https://github.com/(登录后)上单击您的个人资料图片,然后在设置"上>个人访问令牌>生成新令牌.按照向导选择要授予的内容,至少您需要回购.

I would advise you can use Personal access tokens. Just click on your profile picture on the site https://github.com/ (after login), then on Settings > Personal access tokens > Generate new token. Follow the wizard to select what to grant, at least you'll need repo.

在VS Code上,您将提供通常的用户名,在密码中,将提供新生成的PAT.

On VS Code you provide your usual user name and for password you provide the newly generated PAT.

这篇关于如何在github和2FA中使用Visual Studio代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆