我有几个存储库,我显然是在使用GitHub的密码验证的缓存版本。我最近才知道这一点,因为GitHub不再支持密码,而是需要个人访问令牌(PAT)或SSH密钥。
对于所有pull或push上的私有存储库,我会得到以下消息:
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://github.com/villano-lab/CEvNS.git/': The requested URL returned error: 403
我通过看
this
邮递根据这些信息,我推断我应该检查我的参数
credential.helper
.通过这样做:
git config --list
我发现它被设置为这样的“存储”:
credential.helper=store
所以我把它设置成这样:
git config credential.helper ""
它允许我再次输入用户名和密码(而不是由git客户端默认提供)。然后我就可以
create a GitHub Personal Access Token
在密码字段中使用它,新的GitHub要求得到满足,我没有得到错误。
问题是,我该如何使其永久化?比如,我如何将PAT放入git客户端缓存中,这样就不必像以前那样再次键入它?现在如果我回到:
git config credential.helper store
它将返回到旧密码,GitHub将拒绝它。