问题描述
我刚刚安装GIT中的Windows 2.5.0在Windows 7上,似乎当我运行混帐击未执行我的的.bashrc
文件。
I've just installed Git for Windows 2.5.0 on Windows 7, and it appears that my .bashrc
file is not being executed when I run Git Bash.
我创建的文件,像这样:
I created the file like so:
Administrator@HintTech-Dev MINGW64 /
$ pwd
/
Administrator@HintTech-Dev MINGW64 /
$ cd ~
Administrator@HintTech-Dev MINGW64 ~
$ pwd
/c/Users/Administrator
Administrator@HintTech-Dev MINGW64 ~
$ touch .bashrc
Administrator@HintTech-Dev MINGW64 ~
$ vi .bashrc
[... I insert the line "ZZZTESTVAR=234" (without the quotes) into the file in vim ...]
Administrator@HintTech-Dev MINGW64 ~
$ exit
然而,当我下一次运行git击:
Yet, when I next run Git Bash:
Administrator@HintTech-Dev MINGW64 /
$ set | grep ZZZ
Administrator@HintTech-Dev MINGW64 /
$ cat ~/.bashrc
ZZZTESTVAR=234
Administrator@HintTech-Dev MINGW64 /
$ ZZZTESTVAR=234
Administrator@HintTech-Dev MINGW64 /
$ set | grep ZZZ
ZZZTESTVAR=234
Administrator@HintTech-Dev MINGW64 /
$
为什么我的的.bashrc
正在运行?这似乎是在正确的地方,并有正确的权限。
Why isn't my .bashrc
being run? It seems to be in the right place and have the right permissions.
推荐答案
OK,我发现了这个问题。简单地说,通过为Windows 2.5.0(mintty)最新的Git使用bash的终端不懒得看的.bashrc
- 它读。在.bash_profile
。所以,你可以设置你的环境的.bash_profile
和/或把这个code。在开始读的.bashrc
:
OK, I found out the problem. Quite simply, the bash terminal used by the latest Git for Windows 2.5.0 (mintty) doesn't bother to read .bashrc
- it reads .bash_profile
. So you can set up your environment in .bash_profile
and/or put this code at the start to read .bashrc
:
if [ -f ~/.bashrc ]
then
. ~/.bashrc
fi
这篇关于混帐for Windows不执行我的.bashrc文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!