如何在github和2FA上使用Visual Studio代码

问题描述 投票:3回答:1

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

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

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

但是,这也不起作用。

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

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文档所说的。同样也累了,同样的问题。

任何人都能正常工作吗?

而且,有人知道VSCode需要哪个“作用域”吗?我只是勾选了“回购”。这可能是问题,需要更多吗?

github visual-studio-code
1个回答
0
投票

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

在VS Code上,您提供通常的用户名,对于密码,您提供新生成的PAT。

© www.soinside.com 2019 - 2024. All rights reserved.