Py学习  »  Git

Anaconda4.5.11和Python3.7.0版本没有稳定地集成到Git中,它在配置之后可以工作,但是下次我打开GitBash时它就消失了[复制]

Andrés • 4 年前 • 586 次点击  

我刚刚在Windows7上安装了Windows2.5.0的Git,看起来 .bashrc 我运行git bash时未执行文件。

我创建的文件是这样的:

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 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 /
$

为什么不是我的 BASHC 跑步?它似乎在正确的位置,拥有正确的权限。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/42967
 
586 次点击  
文章 [ 4 ]  |  最新文章 4 年前
code_cowboy
Reply   •   1 楼
code_cowboy    5 年前

也许这个答案有点晚了,但你可以打电话给 bash -rcfile 论点后接你的位置 .bashrc 文件。

bash -rcfile C:\Users\name\.bashrc

我已将此添加到powershell配置文件(.ps1文件)的末尾,以便powershell在中自动打开 猛击 并配置为我的首选项。

John Livermore
Reply   •   2 楼
John Livermore    8 年前

最新版本的git for windows(2.8.3.windows.1)现在使用的是“profile”文件,而不是.bash_配置文件。我认为这是这样的,所以它没有隐藏和一个有效的文件名。以前似乎没有引起任何问题,但可能会让人困惑。

user932885
Reply   •   3 楼
user932885    8 年前

当我在Windows10中升级到GitBash2.5.0时,同样的事情也发生在我身上。我重命名了我的“.bashrc”->“.bash_profile”,并重新启动了git bash。一切又恢复正常了。

mv ~/.bashrc ~/.bash_profile
Jez
Reply   •   4 楼
Jez    8 年前

好的,我发现了问题。很简单,最新的gitforwindows2.5.0(mintty)所使用的bash终端不需要阅读 .bashrc -读 .bash_profile . 所以你可以在 .bash_u配置文件 和/或将此代码放在开始处阅读 BASHC :

if [ -f ~/.bashrc ]
then
    . ~/.bashrc
fi