【问题标题】:Could not symlink share/git-core/contrib /usr/local/share/git-core is not writable无法符号链接 share/git-core/contrib /usr/local/share/git-core 不可写
【发布时间】:2014-11-12 22:56:57
【问题描述】:

我确实尝试并使用了任何建议,从修复、卸载所有内容到重新安装等,但没有任何解决方案有效。我完全陷入困境,需要帮助才能找到解决方案!在此先感谢克里斯托夫

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.

【问题讨论】:

    标签: git macos homebrew


    【解决方案1】:

    这可能是与权限有关的错误。

    试试

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

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

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

    可能就够了。

    然后运行

    brew link git
    

    再次。

    【讨论】:

    • 谢谢,但这也无济于事....终端告诉我:Christophs-MacBook-2:~ AWChristoph$ brew link git Error: No such keg: /usr/local/Cellar /git
    • 那里似乎是同样的问题。做一个sudo chown -R $(whoami) /usr/local/Cellar/
    • @AWChristoph:这有帮助吗?
    • @AWChristoph:我认为你有点忽略了我们使用 chown -R 所做的事情。每次您偶然发现新的 permission denied 消息时,那是因为当前正在运行 brew 命令的用户没有写入这些目录的权限。话虽如此,对于您发布的这条最新消息,您需要执行chown -R $(whoami) /usr/local/lib/perl5/。但也许只做sudo brew link git 会更容易。不过,通常不建议这样做。
    • 我正在运行 ZSH,对我来说是:sudo chown -R $(whoami) /usr/local/share/zsh/site-functions
    【解决方案2】:

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

    运行:

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

    然后运行:

    brew link git
    

    【讨论】:

    • 他告诉我:没有这样的小桶:/usr/local/Cellar/git
    【解决方案3】:

    在更改权限之前,我会:

    选项 1:尝试卸载 brew

    1 ) 保存您的 brew 软件包列表:

    brew list > my_packages.txt
    

    2) 然后uninstall brew:

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
    

    3)Re-install brew:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    

    4 ) 重新安装所有软件包:

    brew install $(< my_packages.txt )
    

    选项 2:

    如果这不起作用,请尝试运行:

    brew doctor
    

    检查是否可以使用以下方法修剪错误:

    brew prune
    

    Reference.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-12-26
      • 2018-08-07
      • 1970-01-01
      • 2015-12-23
      • 1970-01-01
      • 2013-04-25
      • 1970-01-01
      相关资源
      最近更新 更多