我最近开始在GitHub上使用双因素认证,现在无法像通常那样在私有存储库上通过https使用git:
peter@computer:~$ git clone https://github.com/[...]/MyPrivateRepo
Cloning into 'MyPrivateRepo'...
Username for 'https://github.com': [...]
Password for 'https://[...]@github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/[...]/MyPrivateRepo/'
如果我禁用双重认证,我就可以像以前一样使用它:peter@computer:~$ git clone https://github.com/[...]/MyPrivateRepo
Cloning into 'MyPrivateRepo'...
Username for 'https://github.com': [...]
Password for 'https://[...]@github.com':
remote: Counting objects: 147, done.
remote: Total 147 (delta 0), reused 0 (delta 0), pack-reused 147
Receiving objects: 100% (147/147), 22.70 KiB | 0 bytes/s, done.
Resolving deltas: 100% (87/87), done.
Checking connectivity... done.
我知道我可以使用SSH并且一切正常,但是否有一种方法可以在仍然能够使用GitHub的HTTPS的同时保持双因素身份验证,例如通过在我的请求中发送一个身份验证令牌?