windows 在 Intellij 终端中设置 git
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21676150/
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
Setup git in Intellij terminal
提问by user2302448
I want to use git in Intellij Terminal but it does not recognize the command. In Command Prompt and Windows power shell the command in recognized (I added the git path in System Environment Variables). I am also aware that Intellij has an GUI integration with Git.
我想在 Intellij 终端中使用 git,但它无法识别该命令。在命令提示符和 Windows power shell 中,已识别命令(我在系统环境变量中添加了 git 路径)。我也知道 Intellij 有一个与 Git 的 GUI 集成。
So, can anyone tell me how can I use the git command in the Intellij terminal.
那么,谁能告诉我如何在 Intellij 终端中使用 git 命令。
回答by Aleksej Shovgenja
Setup JetBrains(InteliJ, WebStorm, PHPStorm) IDE terminal to use GIT bash
设置 JetBrains(InteliJ, WebStorm, PHPStorm) IDE 终端以使用 GIT bash
- File
- Settings
- (Enter 'Terminal' in search)
- Change Shell path to:
- 文件
- 设置
- (在搜索中输入“终端”)
- 将外壳路径更改为:
"C:\Program Files\Git\bin\sh.exe" --login -i
"C:\Program Files\Git\bin\sh.exe" --login -i
or
或者
"C:\Program Files\Git\bin\bash.exe"
If you have another directory for installed git change it respectively.
如果您有另一个用于安装 git 的目录,请分别更改它。
回答by Daniel Czajka
you don't need to reinstall anything. Go to:
你不需要重新安装任何东西。去:
-File -Settings -Search for terminal - in shell path type: "C:\Program Files\Git\bin\sh.exe" --login -i (or another directory where you installed Git) Please let me know if that worked fine for you
-File -Settings -Search for terminal - 在 shell 路径中输入:“C:\Program Files\Git\bin\sh.exe”--login -i(或其他安装 Git 的目录)请告诉我是否有效对你很好
回答by Alvic
The full path is not needed anymore (windows), I just replaced cmd.exe to sh.exe and bingo was his name O
不再需要完整路径(windows),我只是将 cmd.exe 替换为 sh.exe,bingo 是他的名字 O
Settings > Tools > Terminal > Shell path sh.exe
设置 > 工具 > 终端 > Shell 路径 sh.exe
回答by Siamak
This worked for me:
这对我有用:
IntelliJ: File->Settings->Version Control->Git:
IntelliJ:文件->设置->版本控制-> Git:
On the right side, Path to Git executable:
在右侧,Git 可执行文件的路径:
"C:\Program Files\Git\bin\git.exe"
"C:\Program Files\Git\bin\git.exe"
回答by davidjmcclelland
(Windows) To use Git in IntelliJ terminal without switching terminal emulator to GiT Bash:
(Windows) 在 IntelliJ 终端中使用 Git 而不将终端模拟器切换到 GiT Bash:
- Reinstall Git
- choose "Use Git from the Windows Command Prompt"
- choose "Use Windows' default console window"
- Restart Intellij
- enter "git version" in terminal to confirm
- 重新安装 Git
- 选择“从 Windows 命令提示符使用 Git”
- 选择“使用 Windows 的默认控制台窗口”
- 重启 Intellij
- 在终端输入“git version”进行确认