40

I added cmd as external tool in PyCharm, and it works nicely in PyCharm console (View -> Run). Here is 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.

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

proxy
  • 846
  • 2
  • 11
  • 24

3 Answers3

69

Configure the Terminal to use bash.exe or sh.exe from Git installation like this:

sh.exe

"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.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • HOW? Terminal looks like blank space, I cant type in it. Its just useless brick. I also got some Version Control Console, its only displays something useless and irrelevant, but it also a brick without input. – proxy Dec 16 '13 at 14:05
  • 1
    Commands can be typed in the Terminal: http://img36.imageshack.us/img36/2138/3sx0.png. – CrazyCoder Dec 16 '13 at 14:08
  • 2
    What OS version do you use? Can you share [idea.log](https://intellij-support.jetbrains.com/entries/23352446)? Please note that Terminal is currently not compatible with Windows XP. – CrazyCoder Dec 16 '13 at 14:18
  • 2
    Worked without --login – bikram Jan 31 '20 at 16:38
  • 1
    --login seems to give me color output. – David Glass Dec 27 '20 at 14:53
  • What does --login do? – Andromeda Mar 31 '21 at 07:43
  • 1
    @Andromeda See https://linux.die.net/man/1/sh: "When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable." – CrazyCoder Mar 31 '21 at 07:46
55

File -> settings -> terminal -> shell path

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

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

Or this for 64-bit installation:

"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:

  1. There is an istallation of git in the specified path.
  2. You have used quotes around the path.
Nick Volynkin
  • 14,023
  • 6
  • 43
  • 67
nagordon
  • 1,307
  • 2
  • 13
  • 16
-1

You must add to PATH variable

;C:\Program Files\Git\bin

And open terminal in idea.

Vurtatoo
  • 346
  • 3
  • 8