最近在安裝git的過程中,因?yàn)殡娔X版本的原因無法安裝Xcode顾复,導(dǎo)致了git無法正常使用班挖。使用git --version的時候總是報錯:
xcode-select: note: no developer tools were found at '/Applications/Xcode.app',
requesting install. Choose an option in the dialog to download the command line
developer tools.
只能通過另外一種方法使用解決此問題:
1.查看mac上Git默認(rèn)(應(yīng)該/理論)安裝位置
which -a git
結(jié)果
/usr/bin/git
2.查看mac上Git實(shí)際安裝位置
which git
結(jié)果
/usr/local/bin/git
發(fā)生問題的原因就是這個了,系統(tǒng)默認(rèn)git的目錄和git默認(rèn)安裝目錄不一致導(dǎo)致的捕透。找到原因了聪姿,就好解決這個問題了,這要想辦法讓目錄一致就好了乙嘀。
我使用的方法是建立軟連接的方法:
1末购、進(jìn)入 /usr/bin 目錄,使用 find git 命令虎谢,看看有沒有盟榴,如果有,就使用 sudo rm -rf git 命令把它刪除掉婴噩;
2擎场、還是在 /usr/bin 目錄下羽德,使用sudo ln -s /usr/local/git/bin/git git 命令建立git的軟連接;
3迅办、使用 git --version 命令宅静,這個時候git命令就好使啦。
參考博客:https://blog.csdn.net/u011968063/article/details/70149191