Why is “MINGW64” appearing on my Git bash?

旧街凉风 提交于 2019-12-03 18:22:29

问题


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.

The bash is quite different, including a purple "MINGW64" in every line. Why is it there?

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.exe from https://git-scm.com/downloads .

Thanks!


回答1:


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.

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.




回答2:


Easiest way to remove 'MINGW64' is to comment two lines in file:

\Git\etc\profile.d\git-prompt.sh
...
# PS1="$PS1"'\[\033[35m\]'       # change to purple
# PS1="$PS1"'$MSYSTEM '          # show MSYSTEM



回答3:


"Git for windows" includes git plus a variety of additional software, which you may already have on your machine. This includes:

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

As PS1 tastes are generally personal you may prefer your existing setup.

If you want git, but don't want all the extra software, you can get a minimal build from 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:

 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.

(Add-Pathvariable comes from PSCX by the way)




回答4:


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.

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 other bash.

This is important to know that the two environments are separate, since programs from one environment may not be installed in the other.




回答5:


export PS1="${PS1/\$TITLEPREFIX:}"; export PS1="${PS1/\$MSYSTEM }" >> ~/.bashrc




回答6:


It's a little different in the new git versions.

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



来源:https://stackoverflow.com/questions/32356595/why-is-mingw64-appearing-on-my-git-bash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!