【问题标题】:fatal: unable to access CAfile. could not lock config file gitconfig致命:无法访问 CAfile。无法锁定配置文件 gitconfig
【发布时间】:2018-04-18 09:56:10
【问题描述】:

当我尝试从 git 中提取时,出现以下错误:

$ git 拉 致命:无法访问'https://gitlab.ZZZ.com/S.A/Test-Practise.git/':错误设置 证书验证位置: CAfile:C:/Program Files/Git/path/to/Git/mingw64/ssl/certs/ca-bundle.crt CApath:无

当我尝试这样做时:

$ git config --system http.sslcainfo "C:\Program Files\git\bin\curl-ca-bundle.crt"

或者:

$ git config --system http.sslverify false

我收到以下错误:

错误:无法锁定配置文件 C:\Program Files\Git\mingw64/etc/gitconfig:权限被拒绝

注意:我尝试重新安装 git,以管理员身份运行它,但我仍然遇到同样的问题。

期待帮助/建议。 有什么想法吗??

【问题讨论】:

    标签: git github gitlab


    【解决方案1】:

    我猜你的 git.config 由 root 拥有,而不是你的用户。如果您之前输入sudo,您的命令是否有效? 这应该将 .git 目录的所有者更改为您的用户名:

    sudo chown username -R .git

    【讨论】:

    • 如果我添加 sudo 则无法正常工作,如果我尝试运行您在上述评论中给出的代码,则会收到错误为 "bash: sudo: command not found"
    • @Sultan 您使用的是哪个操作系统?您必须为您的用户安装 sudo 才能使用它。
    • @Philj0 我使用的是 Windows 10
    • @Sultan 好的,我对 Windows 不是很熟悉,但我想您可以运行“runas /noprofile /user:Administrator cmd”以管理员身份启动命令 shell。然后你可以使用没有 sudo 的命令。
    猜你喜欢
    • 1970-01-01
    • 2019-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-08
    • 2017-12-24
    • 2017-12-21
    • 2021-11-07
    相关资源
    最近更新 更多