使用Github + HTTPS +双因素身份验证时存储令牌

时间:2015-03-04 20:27:33

标签: git authentication github

我使用HTTPS远程网址recommended by Github从Github获得了git clone个回购。

我还在我的Github帐户(also recommended)中设置了双因素身份验证,这意味着我必须generate a token才能将更改推送到我的仓库。

现在,每当我尝试按git询问我的用户名和密码时。

这里已经多次解决了这个问题,StackOverflow(Git asks for username everytime I pushHow secure is storing password with Git?)和Github的共识似乎是:不要使用{{ 1}}要记住您的令牌,请改用git config credential.helper store

根据Github的说法,我可以设置一个时间来缓存我的令牌:

git config --global credential.helper cache

由于获取新令牌的过程为rather cumbersome,我想将其存储很长时间。

这点我不确定我是否正确使用该工具。如果我将令牌设置为缓存一个月,那会没关系吗?

git config --global credential.helper 'cache --timeout=3600'

在我看来,这似乎是一种令人费解的方式。这是应该做的方式还是我做错了?

0 个答案:

没有答案
相关问题