我无法卸载 Git
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27330132/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I can't uninstall Git
提问by lazev
I tried to update my git version on Mac OS X 10.7, but it doesn't change the version. It's still on 2.0.
我尝试在 Mac OS X 10.7 上更新我的 git 版本,但它没有更改版本。它仍然在2.0上。
If I run,
如果我跑,
rm -rf /usr/local/git
rm /etc/paths.d/git
rm /etc/manpaths.d/git
the new version gets uninstalled, but the old one is still there (git
is still a valid command).
新版本被卸载,但旧版本仍然存在(git
仍然是一个有效的命令)。
How can I find the directory where this "ghost" version is installed?
如何找到安装此“ghost”版本的目录?
回答by VonC
To see where git is installed:
查看 git 的安装位置:
which git
See for instance those guides:
例如,请参阅这些指南:
- "Beginner's Setup Guide for Git & Github on Mac OS X"
- "Install and Update to latest version Git on Mac OSX 10.10 Yosemite"
The location usually is:
地点通常是:
/usr/local/git/bin/git
As mentioned in "Can't seem to uninstall git":
正如“似乎无法卸载 git”中所述:
/opt/local/bin
is the location of software installed by macports, so you'll want to run this:
/opt/local/bin
是 macports 安装的软件的位置,因此您需要运行以下命令:
sudo port uninstall git
If you see /usr/local/bin/git, that is likely a brew installation: see "Can't use homebrew installed git":
如果您看到 /usr/local/bin/git,那可能是 brew 安装:请参阅“无法使用自制安装的 git”:
brew uninstall git
# make sure everything is alright, maybe brew will give you some hint
brew doctor
brew update
brew install git
# magic happen, brew will give you hint /usr/bin occurs before /usr/local/bin
# and recommend you run following command
brew doctor
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile