symlink share/git-core/contrib/usr/local/share/git-core无法写入

AWC*_*oph 13 git macos homebrew

我真的尝试过使用修复,卸载所有内容,重新安装等任何建议,但没有解决方案.我完全陷入困境,需要帮助才能找到解决方案!先谢谢,Christoph

MacBook-2:~ MyUserName$ brew install git
Warning: git-2.1.3 already installed, it's just not linked
MacBook-2:~ MyUserName$ brew destroy git
Error: Unknown command: destroy
MacBook-2:~ MyUserName$ brew uninstall git
Uninstalling /usr/local/Cellar/git/2.1.3...
MacBook-2:~ MyUserName$ brew install git
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-    2.1.3.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/git-2.1.3.yosemite.bottle.tar.gz
==> Pouring git-2.1.3.yosemite.bottle.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
 /usr/local/bin/git-credential-osxkeychain

The 'contrib' directory has been installed to:
 /usr/local/share/git-core/contrib

Bash completion has been installed to:
 /usr/local/etc/bash_completion.d

zsh completion has been installed to:
 /usr/local/share/zsh/site-functions
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/git-core/contrib
 /usr/local/share/git-core is not writable.

You can try again using:
 brew link git
==> Summary
  /usr/local/Cellar/git/2.1.3: 1342 files, 32M
MacBook-2:~ MyUserName$ brew link git
Linking /usr/local/Cellar/git/2.1.3... 
Error: Could not symlink share/git-core/contrib
 /usr/local/share/git-core is not writable.
Run Code Online (Sandbox Code Playgroud)

mat*_*ias 29

这可能是与权限相关的错误.

尝试

sudo chown -R $(whoami) /usr/local/share/
Run Code Online (Sandbox Code Playgroud)

或者,如果你只需要在git-core路径上,

sudo chown -R $(whoami) /usr/local/share/git-core 
Run Code Online (Sandbox Code Playgroud)

可能就够了.

然后跑

brew link git
Run Code Online (Sandbox Code Playgroud)

再次.

  • @AWChristoph:我觉得你有点想念我们用chown -R做的事情.每次你偶然发现一个新的_permission denied_消息,这是因为当前正在运行`brew`命令的用户没有权限写入这些目录.话虽如此,对于你发布的这条最新消息,你需要做`chown -R $(whoami)/ usr/local/lib/perl5 /`.但也许只做"sudo brew link git"会更容易.虽然,通常不建议这样做. (3认同)

Fav*_*orr 13

也许你之前使用sudo安装一些应用程序,所以字典的所有者/usr/local/share/和/usr/local/lib成为root

跑:

sudo chown -R $(whoami) /usr/local/share/

sudo chown -R $(whoami) /usr/local/lib
Run Code Online (Sandbox Code Playgroud)

然后运行:

brew link git
Run Code Online (Sandbox Code Playgroud)