美文网首页
Git提交时提示"fatal unable to ge

Git提交时提示"fatal unable to ge

作者: 滚石_c2a6 | 来源:发表于2018-06-05 10:19 被阅读28次

    转自:https://my.oschina.net/u/2552286/blog/1518334
    git 每次都要求输入username和password
    git config --global credential.helper store
    但是设置了之后会报"fatal unable to get credential storage lock File exists"
    删除 C:\Users\Administrator.git-credentials.lock 的文件

    转自:https://www.jianshu.com/p/8a015684f3e1

    问题

    今天在提交git项目时遇到提示:fatal: unable to get credential storage lock: File exists。
    但是似乎提交依然成功了,不知道这个报错有什么影响。

    原因

    git config --list 发现
    git的config中credential.helper项有重复,我的是同时含有credential.helper=storecredential.helper=manager

    解决办法

    在git的config中找到credential.helper项,删除其中一项。

    1. 首先要确定是否是有config中credential.helper重复引起的问题,执行git config -l可查看所有参数
    2. 确定参数配置的位置。分别执行
      • git config --local -l
      • git config --global -l
      • git config --system -l
        可查看当前项目、全局、系统的参数,找到credential.helper=manager的那一项
    3. 如果是在系统参数中,则执行git config --system --unset credential.helper即可删除system中的此参数配置。如果是在local或global则将其中的system替换即可。
    4. 如果依然有问题,可尝试升级Git版本到2.9.0以上并再次修改config。

    补充说明

    除了使用指令修改config外也可直接找到配置文件修改。
    在win中,git的config配置文件路径分别为:

    • local:在当前项目的.git/config文件中,默认.git是隐藏文件
    • global:在%HOME%/.gitconfig中,%HOME%为系统自带环境变量,一般为C:\Users\<username>,相当与linux的~。另外.gitconfig文件可能也是隐藏的
    • system:在git安装目录的mingw64\etc\gitconfig文件中

    在linux中,git的config配置文件路径分别为:

    • local:也是在当前项目的.git/config文件中
    • global:在/.gitconfig中,为当前用户的主目录
    • system:在根目录/etc/gitconfig文件中

    参考

    Stackoverflow--fatal: unable to get credential storage lock: File exists
    Github--Can't deal with lock file .git-credentials.lock when exec git push in v2.8.3

    作者:zgjx
    链接:https://www.jianshu.com/p/8a015684f3e1
    來源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

    相关文章

      网友评论

          本文标题:Git提交时提示"fatal unable to ge

          本文链接:https://www.haomeiwen.com/subject/edhpsftx.html