简体   繁体   English

有没有办法不为在 macOS 中使用 git 编写“sudo”?

[英]Is there a way to not write 'sudo' for using git in macOS?

I'm on macOS Catalina, every time I use git commands I have to use sudo git $CMD ;我在 macOS Catalina 上,每次使用 git 命令时,我都必须使用sudo git $CMD without it the errors like unable to access '/Users/$USER/.config/git/...': Permission Denied persists.没有它,诸如unable to access '/Users/$USER/.config/git/...': Permission Denied之类的错误仍然存在。 I would like to fix this globally such that I don't have to write sudo for every repository.我想在全球范围内解决这个问题,这样我就不必为每个存储库编写 sudo 了。

Global fix:全局修复:

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

If there's no group,如果没有群,

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

Credit goes to TheDevMinerTV on Discord(CS Army) for the solution.该解决方案归功于 Discord(CS Army)上的 TheDevMinerTV。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM