【问题标题】:Should I delete either credential.helper=store or credential.helper=manager to avoid to type in my credentials every time?我是否应该删除 credential.helper=store 或 credential.helper=manager 以避免每次都输入我的凭据?
【发布时间】:2020-04-03 19:57:36
【问题描述】:

我有一段时间没有在我的 github 帐户上推送代码了。

今天我尝试了

git push -u origin master

我的命令提示符(Anaconda)要求我输入我的 github 用户名和密码

登录失败,使用 ctrl+c 取消基本凭据提示。

https://github.com/”的用户名:我的用户名

https://myusername@github.com/”的密码:

我输入了这些,然后提示回复:

致命:无法获得凭证存储锁:文件存在

我可以毫无问题地推送代码,但我希望不必每次都输入用户名和密码。

我做了一些搜索,发现我遇到的错误在这个thread 中突出显示,其中建议该错误是由 git 配置中有多个credential.helper= 代码行引起的。还建议只保留其中一行,以调整错误。

所以,通过输入

git config --list

我发现我的 .git/config 文件中有两条代码行 credential.helper=
一个在系统config文件中,一个在全局config文件中

git config --list --system

credential.helper=manager

git config --list --global

credential.helper=store

但在我的 .git/config 文件中,我找不到任何以 credential.helper= 开头的行。

那么我在哪里可以找到这些行?

我应该删除credential.helper=storecredential.helper=manager 以避免每次都输入我的凭据吗?

【问题讨论】:

    标签: git credentials git-config credential-manager


    【解决方案1】:

    您的主目录中有一个卡住的.git-credentials.lock 文件。它可能包含您的明文密码,因此您应该删除它。

    git-credential-store:

    使用此帮助程序会将未加密的密码存储在磁盘上, 仅受文件系统权限保护。如果这是不可接受的 安全权衡,尝试 git-credential-cache,或者找一个助手 与您的操作系统提供的安全存储集成。

    你应该坚持使用manager提供的操作系统。

    您可以使用git config--show-origin 选项显示设置来自哪个文件。

    但您也可以使用命令git config --unset --global credential.helper 将其删除。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-27
      • 2020-07-24
      • 2013-01-29
      • 1970-01-01
      • 1970-01-01
      • 2016-07-06
      • 1970-01-01
      • 2021-12-16
      相关资源
      最近更新 更多