【问题标题】:Pycharm terminal is pointing to the wrong git executable (MacOS)Pycharm 终端指向错误的 git 可执行文件(MacOS)
【发布时间】:2021-01-15 09:19:06
【问题描述】:

我正在尝试在 Pycharm 终端中使用 git,但是当我输入 which git 时,我得到 /usr/bin/git,当我尝试运行 git 时,我得到一个错误(包括堆栈跟踪):

git: error: unable to find utility "git", not a developer tool or in PATH

但是,在普通的 Mac 终端中,如果我输入 which git,我会得到 /usr/local/bin/git,并且这个可执行文件可以正常运行。

如何让 Pycharm 终端指向正确的 git?我尝试更新 $PATH 并在 Pycharm 首选项中更改 git 可执行文件的路径(并在执行此操作后重新启动 Pycharm),但这些都不起作用。

【问题讨论】:

    标签: git macos pycharm


    【解决方案1】:

    问题可能是因为您缺少添加可执行文件的文件扩展名。

    在 PyCharm 终端设置中更改您的 shell 路径。设置位于:

    Settings > Tools > Terminal > Application settings > shell path
    

    在 MacOs 中找到对应的 shell 或 bash 可执行路径。应该在/usr/local/bin/<executable(git or bash or sh) with its extension>

    对于windows,扩展名是.exe:

    C:\Program Files\Git\bin\sh.exeC:\Program Files\Git\bin\bash.exe

    参考

    P.S.此终端设置特定于项目,您可能需要为每个新项目更改设置。

    【讨论】:

      猜你喜欢
      • 2015-03-29
      • 1970-01-01
      • 2013-12-14
      • 1970-01-01
      • 2019-03-15
      • 1970-01-01
      • 2021-10-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多