Git for Windows doesn't execute my .bashrc file












37














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.










share|improve this question






















  • 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
















37














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.










share|improve this question






















  • 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














37












37








37


8





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.










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 24 '15 at 16:06









Jez

11.7k1881151




11.7k1881151












  • 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












  • 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












3 Answers
3






active

oldest

votes


















63














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





share|improve this answer





















  • 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



















19














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





share|improve this answer

















  • 1




    That's almost identical to the one above, but they both work well
    – Mike_K
    Oct 5 '15 at 14:40



















2














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.






share|improve this answer





















    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',
    autoActivateHeartbeat: false,
    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    63














    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





    share|improve this answer





















    • 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
















    63














    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





    share|improve this answer





















    • 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














    63












    63








    63






    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





    share|improve this answer












    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






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Aug 24 '15 at 18:30









    Jez

    11.7k1881151




    11.7k1881151












    • 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




    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













    19














    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





    share|improve this answer

















    • 1




      That's almost identical to the one above, but they both work well
      – Mike_K
      Oct 5 '15 at 14:40
















    19














    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





    share|improve this answer

















    • 1




      That's almost identical to the one above, but they both work well
      – Mike_K
      Oct 5 '15 at 14:40














    19












    19








    19






    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





    share|improve this answer












    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






    share|improve this answer












    share|improve this answer



    share|improve this answer










    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














    • 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











    2














    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.






    share|improve this answer


























      2














      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.






      share|improve this answer
























        2












        2








        2






        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.






        share|improve this answer












        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 25 '16 at 20:58









        John Livermore

        10.3k3189157




        10.3k3189157






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            'app-layout' is not a known element: how to share Component with different Modules

            android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

            WPF add header to Image with URL pettitions [duplicate]