[Brew]brew update命令: fatal: not in a git directory

 brew 更新报错:

$ brew update              
fatal: not in a git directory
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!

解决方法:

1、在homebrew-core目录下,执行了git remote -v:

$ cd /opt/homebrew/Library/Taps/homebrew/homebrew-core/
$ git remote -v
origin	https://github.com/Homebrew/homebrew-core (fetch)
origin	https://github.com/Homebrew/homebrew-core (push)

2、去homebrew-services目录下执行git remote -v:

$ cd /opt/homebrew/Library/Taps/homebrew/homebrew-services/
$ git remote -v
fatal: detected dubious ownership in repository at '/opt/homebrew/Library/Taps/homebrew/homebrew-services'
To add an exception for this directory, call:
 
	git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-services

3、根据提示添加:git安全路径

homebrew-services $ git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-services

#再次执行,无提示成功
homebrew-services $ git remote -v
origin	https://gitee.com/cunkai/homebrew-services.git (fetch)
origin	https://gitee.com/cunkai/homebrew-services.git (push)

你可能感兴趣的:(git,github,macos)