在 PyCharm 中嵌入 Git bash 作为外部工具并在 PyCharm 窗口(windows xp)中使用它

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20573213/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:27:57  来源:igfitidea点击:

Embed Git bash in PyCharm as external tool and work with it in PyCharm window (windows xp)

gitintellij-ideapycharmwindows-xpgit-bash

提问by proxy

I added cmd as external tool in PyCharm, and it works nicely in PyCharm console (View -> Run). Hereis described how to launch Git bash from cmd. It opens in separate window, but I want it to be in the same PyCharm window, so I can type commands without pressing the CTRL+TAB.

我在 PyCharm 中添加了 cmd 作为外部工具,它在 PyCharm 控制台(查看 -> 运行)中运行良好。这里描述了如何从 cmd 启动 Git bash。它在单独的窗口中打开,但我希望它在同一个 PyCharm 窗口中,因此我可以在不按 CTRL+TAB 的情况下键入命令。

I suppose there should be other way, more straight-forward, but I dont see it.

我想应该有其他方式,更直接,但我没有看到。

回答by nagordon

File -> settings -> terminal -> shell path

文件 -> 设置 -> 终端 -> 外壳路径

Paste this if you have a 32-bit installation of Git:

如果您安装了 32 位 Git,请粘贴此内容:

"C:\Program Files (x86)\Git\bin\sh.exe" --login

Or this for 64-bit installation:

或者这对于 64 位安装:

"C:\Program Files\Git\bin\sh.exe" --login

The quotes are important: if you don't specify them you'll get an error because the path contains spaces.

引号很重要:如果你不指定它们,你会得到一个错误,因为路径包含空格。

If you encounter java.io.IOException: Couldn't create PTY, check that:

如果您遇到java.io.IOException: Couldn't create PTY,请检查:

  1. There is an istallation of git in the specified path.
  2. You have used quotes around the path.
  1. 指定路径中存在 git 安装。
  2. 您在路径周围使用了引号。

回答by CrazyCoder

Configure the Terminal to use bash.exeor sh.exefrom Git installation like this:

将终端配置为使用bash.exesh.exe从 Git 安装,如下所示:

sh.exe

sh.exe

"c:\Program Files\Git\bin\sh.exe" --login

"c:\Program Files\Git\bin\sh.exe" --login

Use Tools| Open Terminal...(or click on the Terminal tool window) then run your git command in the Terminal tool window.

使用Tools| Open Terminal...(或单击终端工具窗口)然后在终端工具窗口中运行您的 git 命令。

回答by Vurtatoo

You must add to PATH variable

您必须添加到 PATH 变量

;C:\Program Files\Git\bin

And open terminal in idea.

并在idea中打开终端。