git 我可以将 GitHub 的 2-Factor Authentication 与 TortoiseGit 一起使用吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21892226/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:44:55  来源:igfitidea点击:

Can I use GitHub's 2-Factor Authentication with TortoiseGit?

gitgithubtortoisegit

提问by Return_Of_The_Archons

We like TortoiseGit, and want to take advantage of GitHub's 2-Factor Authentication...but the two don't seem to want to work together.

我们喜欢 TortoiseGit,并希望利用GitHub 的 2-Factor Authentication...但两者似乎不想一起工作。

Has anyone worked out a solution to this?

有没有人想出解决办法?

采纳答案by Return_Of_The_Archons

The GitHub blog post about 2-Factor Authenticationmentions that you can generate a "personal access token", that can be used in place of a password when 2-Factor Auth is enabled:

关于 2-Factor AuthenticationGitHub 博客文章提到您可以生成“个人访问令牌”,当启用 2-Factor Auth 时,它可以用来代替密码:

enter image description here

在此处输入图片说明

I'm not sure if it will actually work with TortoiseGit, but maybe you can give it a try? You can generate an access token at the Authorized applications settings page:

我不确定它是否真的可以与 TortoiseGit 一起使用,但也许您可以尝试一下?您可以在授权应用程序设置页面生成访问令牌:

enter image description here

在此处输入图片说明

回答by Roadkillnz

To compliment Cupcake's answer, use the Personal Access token feature within GitHub.com while using TortoiseGit:

要赞美Cupcake 的回答,请在使用 TortoiseGit 时使用 GitHub.com 中的个人访问令牌功能:

  1. Set up 2-step auth.

  2. Set up a personal access token- taking note of the generated token (use the Copy to clipboard button next to the generated token).

  3. Set TortoiseGit to remember your password as detailed here.

  4. Now perform a pull operation on GitHub.com, enter your username, but instead of using your normal password, use the token that was generated in step #2.

  5. Perform another pull operation on GitHub.com to ensure the token is remembered.

  1. 设置两步验证

  2. 设置个人访问令牌- 记下生成的令牌(使用生成的令牌旁边的复制到剪贴板按钮)。

  3. 设置 TortoiseGit 以记住您的密码,详见此处

  4. 现在在 GitHub.com 上执行拉取操作,输入您的用户名,但不要使用您的普通密码,而是使用在步骤 #2 中生成的令牌。

  5. 在 GitHub.com 上执行另一个拉取操作以确保记住令牌。

回答by Pawel Gorczynski

In case someone has the same problem - using access tokens with TortoiseGit works in general, though for some reason I couldn't force it to use normal authentication prompt, so I had to do git clone https://ghusername:[email protected]/repo.git

如果有人遇到同样的问题 - 使用 TortoiseGit 的访问令牌通常可以工作,但由于某种原因我无法强制它使用正常的身份验证提示,所以我不得不这样做 git clone https://ghusername:[email protected]/repo.git

回答by Guri

You will have to generate access token to pull/push code in Github having two factor authentication using tortoise . Use this token as password.

您必须生成访问令牌以在 Github 中拉/推代码,使用 tortoise 进行两因素身份验证。使用此令牌作为密码。

Here are the additional steps –

以下是额外的步骤——

https://help.github.com/articles/creating-an-access-token-for-command-line-use/

https://help.github.com/articles/creating-an-access-token-for-command-line-use/

https://github.com/settings/tokens

https://github.com/settings/tokens