[英]Pycharm terminal is pointing to the wrong git executable (MacOS)
我試圖在 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),但這些都不起作用。
問題可能是因為您缺少添加可執行文件的文件擴展名。
在 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.exe
或C:\\Program Files\\Git\\bin\\bash.exe
參考:
PS此終端設置特定於項目,您可能需要為每個新項目更改設置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.