为什么git在git安装目录中查找错误的目录? (OS X) [英] Why is git looking in the wrong directory for the git installation? (OS X)
问题描述
我是OS X的新手,在任何地方都找不到解决方法.我安装了git,但是安装混乱了,我不得不将其删除.我使用最新的git dmg文件安装了它,但是每当我键入
I am new to OS X and cannot find anywhere how to fix this. I installed git but the installation was messed up and I had to remove it. I installed it using the latest git dmg file but whenever I type in
git
我知道
-bash: /usr/bin/git: No such file or directory
这是因为git未安装在该目录中,而是安装在/usr/local/bin/git
That is because git is not installed in that directory and instead in /usr/local/bin/git
如果我键入目录的完整路径,则会得到正确的输出.
If I type in the entire path to the directory than I get the correct output.
那么我做错了什么以及如何解决?谢谢.
So what did I do wrong and how do I fix it? Thanks.
推荐答案
我知道这已经超过1年了,但仅适用于遇到此问题的任何人:
I know this is over a year old but just for anyone who experiences this issue:
重命名OS X提供的git客户端并使用Homebrew安装后,我遇到了类似的问题.我发现问题是由于当前的终端会话引起的. OP具有正确的路径,因此我不建议编辑/etc/paths
文件.
I had a similar issue after renaming the OS X provided git client and installing using Homebrew. I found the issue was due to the current terminal session. The OP has the correct paths so I wouldn't recommend editing the /etc/paths
file.
如果在运行which -a git
之后看到/usr/local/bin/git
一切都应正确配置,请打开新终端,并且您应该能够在没有错误的情况下运行git
.
If after running which -a git
you see /usr/local/bin/git
everything should be correctly configured, open a new terminal and you should be able to run git
with no errors.
运行which git
现在应该输出/usr/local/bin/git
.
这篇关于为什么git在git安装目录中查找错误的目录? (OS X)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!