我真的尝试了修复、卸载所有东西再重新安装等各种建议,但没有一个解决方案有效。我完全被卡住了,需要帮助找到解决方案!谢谢您提前的帮助,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.
chown -R
的目的。每当你遇到一个新的“权限被拒绝”的消息时,这是因为当前运行brew
命令的用户没有权限写入这些目录。因此,针对你发布的最新消息,你需要执行chown -R $(whoami) /usr/local/lib/perl5/
。但是也许更容易的方法是直接执行sudo brew link git
。不过,一般情况下不建议这样做。 - mattiassudo
。在所有需要更改当前用户不拥有的目录权限的情况下,您都需要使用sudo
。因此,sudo chown -R $(whoami) /usr/local/lib/perl5/
应该可以解决您的问题。 - mattiassudo chown -R $(whoami) /usr/local/share/zsh/site-functions
。 - originalhatsudo chown -R $(whoami) /usr/local/share/
或者sudo chown -R $(whoami) /usr/local/share/git-core
的方式?我会更新答案,以便适用于ZSH。 - mattias