错误为“错误:无法锁定配置文件.git/config:权限被拒绝".安装迦太基时发生 [英] Error of "error: could not lock config file .git/config: Permission denied" occurs while installing Carthage

查看:1773
本文介绍了错误为“错误:无法锁定配置文件.git/config:权限被拒绝".安装迦太基时发生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用brew install carthage命令在我的Mac OS上安装迦太基.但是,出现以下错误:

I want to install carthage on my Mac OS using brew install carthage command. However, I get the following error:

touch: /usr/local/Homebrew/.git/FETCH_HEAD: Permission denied
touch: /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask/.git/FETCH_HEAD: Permission denied
touch: /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart/.git/FETCH_HEAD: Permission denied
touch: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/.git/FETCH_HEAD: Permission denied
fatal: Unable to create '/usr/local/Homebrew/.git/index.lock': Permission denied
error: could not lock config file .git/config: Permission denied
Warning: carthage 0.26.2 is already installed, it's just not linked.
You can use `brew link carthage` to link this version.

使用sudo brew install carthage时也会出现以下错误:

I also get the following error when I used sudo brew install carthage:

Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

您能告诉我是什么问题吗?提前致谢.

Can you let me know what is the problem. Thanks in advance.

推荐答案

检查这些文件的权限.

ls -l /usr/local/Homebrew/.git/FETCH_HEAD
ls -l /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask/.git/FETCH_HEAD
ls -l /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart/.git/FETCH_HEAD
ls -l /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/.git/FETCH_HEAD

如果没有权限,请运行

sudo chown -R $(whoami):admin /usr/local/* && sudo chmod -R g+rwx /usr/local/*

在High Sierra中,改为运行以下命令:

In High Sierra, Run this command instead:

sudo chown -R $(whoami) $(brew --prefix)/*

您还可以在此处

这篇关于错误为“错误:无法锁定配置文件.git/config:权限被拒绝".安装迦太基时发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆