【问题标题】:Is there a way to not write 'sudo' for using git in macOS?有没有办法不为在 macOS 中使用 git 编写“sudo”?
【发布时间】:2021-01-31 11:48:27
【问题描述】:

我在 macOS Catalina 上,每次使用 git 命令时都必须使用 sudo git $CMD;没有它,像unable to access '/Users/$USER/.config/git/...': Permission Denied 这样的错误仍然存​​在。 我想全局修复这个问题,这样我就不必为每个存储库编写 sudo。

【问题讨论】:

  • 这种情况是由于过去至少使用过一次 sudo 而你不应该使用的。您发布的修复是可以的,因为 .config 中的任何内容都不应归其他任何人所有,但您首先不需要这样做。

标签: git sudo macos-catalina


【解决方案1】:

全局修复:

sudo chown -R ${USER}:${GROUP} "/Users/${USER}/.config"

如果没有组,

sudo chown -R ${USER} "/Users/${USER}/.config"

感谢 Discord(CS Army) 上的 TheDevMinerTV 提供解决方案。

【讨论】:

    猜你喜欢
    • 2023-03-16
    • 2012-09-14
    • 1970-01-01
    • 1970-01-01
    • 2021-02-26
    • 2020-09-16
    • 2019-08-23
    • 2018-08-09
    • 1970-01-01
    相关资源
    最近更新 更多