windows 为什么“MINGW64”出现在我的 Git bash 上?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32356595/
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
Why is "MINGW64" appearing on my Git bash?
提问by FelipeKunzler
I had to format my laptop, and so I had to install Git again. However it is quite different from the one I had yesterday, the icon is not the default orange one anymore, it looks more like Chrome now.
我不得不格式化我的笔记本电脑,所以我不得不再次安装 Git。然而它和我昨天的有很大的不同,图标不再是默认的橙色了,现在看起来更像 Chrome。
The bash
is quite different, including a purple "MINGW64
" in every line. Why is it there?
的bash
是完全不同的,包括紫色“MINGW64
中的每一行”。为什么会在那里?
Is this the new final version? Or did I download something different?
这是新的最终版本吗?还是我下载了不同的东西?
I downloaded https://github.com/git-for-windows/git/releases/download/v2.5.1.windows.1/Git-2.5.1-64-bit.exefrom https://git-scm.com/downloads.
我从https://git-scm下载了https://github.com/git-for-windows/git/releases/download/v2.5.1.windows.1/Git-2.5.1-64-bit.exe 。 com/下载。
Thanks!
谢谢!
采纳答案by patthoyts
This is the new icon being used with Git for Windows 2.x. The website needs an update for that I guess but there are not many volunteers typically.
这是与Git for Windows 2.x一起使用的新图标。我想该网站需要更新,但通常没有多少志愿者。
The MINGW64 is the value from the MSYSTEM
environment variable. This has been included in the bash prompt by setting PS1
in the /etc/bash.bashrc
file. You can either override this in your own $HOME/.profile
or edit the distributed one to remove that if you prefer.
MINGW64 是来自MSYSTEM
环境变量的值。这已通过文件中的设置包含在 bash 提示PS1
中/etc/bash.bashrc
。$HOME/.profile
如果您愿意,您可以自己覆盖它,也可以编辑分布式的以删除它。
回答by raygreentea
Easiest way to remove 'MINGW64' is to comment two lines in file:
删除“MINGW64”的最简单方法是在文件中注释两行:
\Git\etc\profile.d\git-prompt.sh
...
# PS1="$PS1"'\[3[35m\]' # change to purple
# PS1="$PS1"'$MSYSTEM ' # show MSYSTEM
回答by mikemaccana
"Git for windows" includes git plus a variety of additional software, which you may already have on your machine. This includes:
“Windows 版 Git”包括 git 和各种附加软件,您可能已经在您的机器上安装了这些软件。这包括:
- bash (which already comes with Windows 10)
- ssh (which is also now included in Windows 10)
- 'git bash' which includes a preferences for a PS1, a shortcut file, and some other tools.
- bash(已经随 Windows 10 提供)
- ssh(现在也包含在 Windows 10 中)
- 'git bash' 包括 PS1 的首选项、快捷方式文件和其他一些工具。
As PS1 tastes are generally personal you may prefer your existing setup.
由于 PS1 的口味通常是个人的,您可能更喜欢现有的设置。
If you want git, but don't want all the extra software, you can get a minimal build from nuget.
如果你想要 git,但又不想要所有额外的软件,你可以从 nuget 获得最小的构建。
However if you use a GUI that may also include an embedded git - personally I use the one included with Sourcetree. In my powershell profile:
但是,如果您使用的 GUI 还可能包含嵌入式 git - 我个人使用Sourcetree 中包含的那个。在我的 powershell 配置文件中:
Add-PathVariable "${env:UserProfile}\AppData\Local\Atlassian\SourceTree\git_local\bin"
This provides git without any additional changes to your system or extra copies of other software.
这提供了 git,而无需对您的系统或其他软件的额外副本进行任何额外的更改。
(Add-Pathvariable
comes from PSCXby the way)
(顺便Add-Pathvariable
来自PSCX)
回答by Celso
I just noticed this on my machine as well. The orange icon you're referring to is probably the Ubuntu icon you would normally get while running the "Bash on Ubuntu on Windows" app. However, when you installed GIT, it also uses a version of bash. The app is called "Git Bash" in the start menu.
我刚在我的机器上也注意到了这一点。您所指的橙色图标可能是您在运行“Windows 上的 Ubuntu 上的 Bash”应用程序时通常会得到的 Ubuntu 图标。但是,当您安装 GIT 时,它还使用了 bash 版本。该应用程序在开始菜单中称为“Git Bash”。
When I simply typed "Bash" in the search box and then and pressed enter, Windows opened the "best match", which happens (in my case) to be GIT installation with MINGW64. If you type "Ubuntu" instead, or if you look at the start menu's choices, you should see the otherbash.
当我在搜索框中简单地输入“Bash”然后按回车键时,Windows 会打开“最佳匹配”,这恰好(在我的情况下)是使用 MINGW64 安装 GIT。如果您键入“Ubuntu”,或者查看开始菜单的选项,您应该会看到另一个bash。
This is important to know that the two environments are separate, since programs from one environment may not be installed in the other.
知道这两个环境是分开的很重要,因为来自一个环境的程序可能不会安装在另一个环境中。
回答by Jan Kyu Peblik
export PS1="${PS1/\$TITLEPREFIX:}"; export PS1="${PS1/\$MSYSTEM }" >> ~/.bashrc
export PS1="${PS1/\$TITLEPREFIX:}"; export PS1="${PS1/\$MSYSTEM }" >> ~/.bashrc
回答by NOZUONOHIGH
It's a little different in the new git versions.
在新的 git 版本中有点不同。
copy the line below in
/etc/bash.bashrc
:export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[35m\]$MSYSTEM\[\e[0m\] \[\e[33m\]\w\[\e[0m\]\n'"${_ps1_symbol}"' '
add it to
~/.bashrc
and do some custom edit:export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n '
If you do not like the additional blank line when press
Enter
, just remove the\n
above.source the
~/.bashrc
file:source ~/.bashrc
my terminal example:
复制下面的行
/etc/bash.bashrc
:export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[35m\]$MSYSTEM\[\e[0m\] \[\e[33m\]\w\[\e[0m\]\n'"${_ps1_symbol}"' '
将其添加到
~/.bashrc
并进行一些自定义编辑:export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n '
如果你不喜欢按下时额外的空行
Enter
,只需删除\n
上面的。源
~/.bashrc
文件:source ~/.bashrc
我的终端示例: