mac 系统更新后,或者使用备份替换电脑后,git失效

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36898043/article/details/81747687

git 不能使用,提示:

      can't start git:usr/bin/git 

      probably the path to git executable is not valid

这种情况可能出现在系统更新之后,该目录下git无法执行,下面说一下解决办法

一.

git默认路径是在user/bin/git,如果终端输入user/bin/git没有反应说明路径不正确输入which git  查询git路径

1)在终端界面输入 sudo /user/bin/git

提示:

       invalid active developer path (/Library/Developer/CommandLineTools),

       missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

2),因为git与xcode相关联,所以提示这个错误可以重新安装一下

要么输入xcode-select --install

要么输入  sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

3)等待下载即可。

再次输入sudo /user/bin/git,

提示如下图,即成功。

猜你喜欢

转载自blog.csdn.net/qq_36898043/article/details/81747687