git - Mac : Could not symlink share/man/man5/gitattributes. 5 中的 brew 安装 git 错误

标签 git macos github homebrew atlassian-sourcetree

尝试使用

在我的 Mac 系统(High Sierra 10.13.3)上更新 git
brew install git

给出输出

$ brew install git
==> Downloading https://homebrew.bintray.com/bottles/git-2.16.2.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring git-2.16.2.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/man/man5/gitattributes.5
/usr/local/share/man/man5 is not writable.

You can try again using:
  brew link git
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git
==> Summary
🍺  /usr/local/Cellar/git/2.16.2: 1,496 files, 34.5MB

但是,你可以看到它在brew link这一步有问题。尝试通过运行来修复它

brew link git
brew link --overwrite git
brew link --force git

同样的错误

Linking /usr/local/Cellar/git/2.16.2... 
Error: Could not symlink share/man/man5/gitattributes.5
/usr/local/share/man/man5 is not writable.

有人也遇到过这个问题并设法解决了吗?


Mac 的用户和组

enter image description here

输出

enter image description here

最佳答案

您必须修复权限:

sudo chown -R "$USER":admin /usr/local
sudo chown -R "$USER":admin /Library/Caches/Homebrew

如果您是系统上唯一的 Homebrew 软件用户,它运行良好。如果第三方工具正在等待 /usr/local 上的其他权限,则可能会导致问题。但是,我使用这个设置多年没有问题。参见 How to fix homebrew permissions?了解详情。

但为此您必须有权管理计算机。在系统偏好设置 -> 用户和组中,您的用户应该选中“允许用户管理这台计算机”复选框。 p>

关于git - Mac : Could not symlink share/man/man5/gitattributes. 5 中的 brew 安装 git 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49014472/

相关文章:

python - 不忽略 db.sqlite3 文件,即使我在 django 项目的 .gitignore 中指定

git - 从 Git 恢复无法读取 blob,文件现在具有不同的哈希值?

objective-c - 可编写脚本的应用程序示例

html - 我可以从哪里访问我的 netlify.toml 文件?

git - 将 git 子模块移动到另一个目录后失败,错误为 'git status --porcelain' failed in submodule

git - 如何禁用 git gpg 签名

c++ - OSX 磁盘仲裁链接器错误

c++ - 是否有适用于 iOS 的高级音频队列记录服务库?

api - 使用 GitHub V3 API (REST) 创建 fork

ruby - 没有这样的文件或目录 - git ls-files -- WINDOWS