【发布时间】:2021-10-19 18:56:57
【问题描述】:
我有几个存储库,显然我在使用缓存版本的 GitHub 密码身份验证。我最近才知道这一点,因为 GitHub 不再支持密码,而是需要个人访问令牌 (PAT) 或 SSH 密钥。
我会在拉取或推送时收到所有私有存储库的以下消息:
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 会拒绝它。
【问题讨论】:
-
当您选择存储时,它会存储在您的操作系统凭据管理器中。所以你必须找到它的存储位置并删除存储的 Github 凭据,以便 git 再次询问你密码。
-
@Philippe 谢谢。知道如何找到在哪里吗? stackoverflow.com/questions/35942754/… 建议 ~/.git-credentials;但它不存在。