Git for Windows doesn't execute my .bashrc file
up vote
37
down vote
favorite
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
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 /
$
Why isn't my .bashrc
being run? It seems to be in the right place and have the right permissions.
windows git bash windows-7
add a comment |
up vote
37
down vote
favorite
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
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 /
$
Why isn't my .bashrc
being run? It seems to be in the right place and have the right permissions.
windows git bash windows-7
I am running Git bash version 1.9.5-preview20150319 and ran the exact same test you ran, but for me, it worked. My.bashrc
was run. The variable was set. Do you have a.profile
or.bash_profile
in the way? These will stop.bashrc
from being run.
– Wolf
Aug 24 '15 at 17:24
Nope, I don't even have a.profile
or.bash_profile
. But were you using Git for Windows 2.5.0?
– Jez
Aug 24 '15 at 18:20
add a comment |
up vote
37
down vote
favorite
up vote
37
down vote
favorite
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
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 /
$
Why isn't my .bashrc
being run? It seems to be in the right place and have the right permissions.
windows git bash windows-7
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
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 /
$
Why isn't my .bashrc
being run? It seems to be in the right place and have the right permissions.
windows git bash windows-7
windows git bash windows-7
asked Aug 24 '15 at 16:06
Jez
11.4k1879145
11.4k1879145
I am running Git bash version 1.9.5-preview20150319 and ran the exact same test you ran, but for me, it worked. My.bashrc
was run. The variable was set. Do you have a.profile
or.bash_profile
in the way? These will stop.bashrc
from being run.
– Wolf
Aug 24 '15 at 17:24
Nope, I don't even have a.profile
or.bash_profile
. But were you using Git for Windows 2.5.0?
– Jez
Aug 24 '15 at 18:20
add a comment |
I am running Git bash version 1.9.5-preview20150319 and ran the exact same test you ran, but for me, it worked. My.bashrc
was run. The variable was set. Do you have a.profile
or.bash_profile
in the way? These will stop.bashrc
from being run.
– Wolf
Aug 24 '15 at 17:24
Nope, I don't even have a.profile
or.bash_profile
. But were you using Git for Windows 2.5.0?
– Jez
Aug 24 '15 at 18:20
I am running Git bash version 1.9.5-preview20150319 and ran the exact same test you ran, but for me, it worked. My
.bashrc
was run. The variable was set. Do you have a .profile
or .bash_profile
in the way? These will stop .bashrc
from being run.– Wolf
Aug 24 '15 at 17:24
I am running Git bash version 1.9.5-preview20150319 and ran the exact same test you ran, but for me, it worked. My
.bashrc
was run. The variable was set. Do you have a .profile
or .bash_profile
in the way? These will stop .bashrc
from being run.– Wolf
Aug 24 '15 at 17:24
Nope, I don't even have a
.profile
or .bash_profile
. But were you using Git for Windows 2.5.0?– Jez
Aug 24 '15 at 18:20
Nope, I don't even have a
.profile
or .bash_profile
. But were you using Git for Windows 2.5.0?– Jez
Aug 24 '15 at 18:20
add a comment |
3 Answers
3
active
oldest
votes
up vote
62
down vote
accepted
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
It's not mintty per se but how git-bash.exe starts it. Long discussion about it here which basically ends with the installer being changed to create a .bash_profile like you describe: github.com/git-for-windows/git/issues/191
– Marc Stober
Sep 1 '15 at 15:35
add a comment |
up vote
19
down vote
Same thing happened to me when I upgraded to Git Bash 2.5.0 in Windows 10. I renamed my '.bashrc' -> '.bash_profile' and relaunched Git Bash. Everything's working as usual again.
mv ~/.bashrc ~/.bash_profile
1
That's almost identical to the one above, but they both work well
– Mike_K
Oct 5 '15 at 14:40
add a comment |
up vote
2
down vote
It appears the latest version of git for Windows (2.8.3.windows.1) uses a 'profile' file now instead of the .bash_profile. I assume this is so it isn't hidden and a valid file name. Didn't seem to cause any issues before, but maybe it was confusing to people.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32186840%2fgit-for-windows-doesnt-execute-my-bashrc-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
62
down vote
accepted
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
It's not mintty per se but how git-bash.exe starts it. Long discussion about it here which basically ends with the installer being changed to create a .bash_profile like you describe: github.com/git-for-windows/git/issues/191
– Marc Stober
Sep 1 '15 at 15:35
add a comment |
up vote
62
down vote
accepted
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
It's not mintty per se but how git-bash.exe starts it. Long discussion about it here which basically ends with the installer being changed to create a .bash_profile like you describe: github.com/git-for-windows/git/issues/191
– Marc Stober
Sep 1 '15 at 15:35
add a comment |
up vote
62
down vote
accepted
up vote
62
down vote
accepted
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
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
answered Aug 24 '15 at 18:30
Jez
11.4k1879145
11.4k1879145
It's not mintty per se but how git-bash.exe starts it. Long discussion about it here which basically ends with the installer being changed to create a .bash_profile like you describe: github.com/git-for-windows/git/issues/191
– Marc Stober
Sep 1 '15 at 15:35
add a comment |
It's not mintty per se but how git-bash.exe starts it. Long discussion about it here which basically ends with the installer being changed to create a .bash_profile like you describe: github.com/git-for-windows/git/issues/191
– Marc Stober
Sep 1 '15 at 15:35
It's not mintty per se but how git-bash.exe starts it. Long discussion about it here which basically ends with the installer being changed to create a .bash_profile like you describe: github.com/git-for-windows/git/issues/191
– Marc Stober
Sep 1 '15 at 15:35
It's not mintty per se but how git-bash.exe starts it. Long discussion about it here which basically ends with the installer being changed to create a .bash_profile like you describe: github.com/git-for-windows/git/issues/191
– Marc Stober
Sep 1 '15 at 15:35
add a comment |
up vote
19
down vote
Same thing happened to me when I upgraded to Git Bash 2.5.0 in Windows 10. I renamed my '.bashrc' -> '.bash_profile' and relaunched Git Bash. Everything's working as usual again.
mv ~/.bashrc ~/.bash_profile
1
That's almost identical to the one above, but they both work well
– Mike_K
Oct 5 '15 at 14:40
add a comment |
up vote
19
down vote
Same thing happened to me when I upgraded to Git Bash 2.5.0 in Windows 10. I renamed my '.bashrc' -> '.bash_profile' and relaunched Git Bash. Everything's working as usual again.
mv ~/.bashrc ~/.bash_profile
1
That's almost identical to the one above, but they both work well
– Mike_K
Oct 5 '15 at 14:40
add a comment |
up vote
19
down vote
up vote
19
down vote
Same thing happened to me when I upgraded to Git Bash 2.5.0 in Windows 10. I renamed my '.bashrc' -> '.bash_profile' and relaunched Git Bash. Everything's working as usual again.
mv ~/.bashrc ~/.bash_profile
Same thing happened to me when I upgraded to Git Bash 2.5.0 in Windows 10. I renamed my '.bashrc' -> '.bash_profile' and relaunched Git Bash. Everything's working as usual again.
mv ~/.bashrc ~/.bash_profile
answered Aug 25 '15 at 18:31
user932885
32038
32038
1
That's almost identical to the one above, but they both work well
– Mike_K
Oct 5 '15 at 14:40
add a comment |
1
That's almost identical to the one above, but they both work well
– Mike_K
Oct 5 '15 at 14:40
1
1
That's almost identical to the one above, but they both work well
– Mike_K
Oct 5 '15 at 14:40
That's almost identical to the one above, but they both work well
– Mike_K
Oct 5 '15 at 14:40
add a comment |
up vote
2
down vote
It appears the latest version of git for Windows (2.8.3.windows.1) uses a 'profile' file now instead of the .bash_profile. I assume this is so it isn't hidden and a valid file name. Didn't seem to cause any issues before, but maybe it was confusing to people.
add a comment |
up vote
2
down vote
It appears the latest version of git for Windows (2.8.3.windows.1) uses a 'profile' file now instead of the .bash_profile. I assume this is so it isn't hidden and a valid file name. Didn't seem to cause any issues before, but maybe it was confusing to people.
add a comment |
up vote
2
down vote
up vote
2
down vote
It appears the latest version of git for Windows (2.8.3.windows.1) uses a 'profile' file now instead of the .bash_profile. I assume this is so it isn't hidden and a valid file name. Didn't seem to cause any issues before, but maybe it was confusing to people.
It appears the latest version of git for Windows (2.8.3.windows.1) uses a 'profile' file now instead of the .bash_profile. I assume this is so it isn't hidden and a valid file name. Didn't seem to cause any issues before, but maybe it was confusing to people.
answered May 25 '16 at 20:58
John Livermore
10.1k3189156
10.1k3189156
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32186840%2fgit-for-windows-doesnt-execute-my-bashrc-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I am running Git bash version 1.9.5-preview20150319 and ran the exact same test you ran, but for me, it worked. My
.bashrc
was run. The variable was set. Do you have a.profile
or.bash_profile
in the way? These will stop.bashrc
from being run.– Wolf
Aug 24 '15 at 17:24
Nope, I don't even have a
.profile
or.bash_profile
. But were you using Git for Windows 2.5.0?– Jez
Aug 24 '15 at 18:20