Git bash disrespecting profiles #5102

Closed
opened 2026-01-31 00:05:05 +00:00 by claunia · 12 comments
Owner

Originally created by @JasperRev on GitHub (Nov 21, 2019).

Originally assigned to: @DHowett-MSFT on GitHub.

Environment

windows 1909 build 18363

Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd]
Windows Terminal version (if applicable):

Any other software?

no

Steps to reproduce

I've added this to my profiles.json
{
"guid": "{00000000-0000-0000-ba54-000000000002}",
"acrylicOpacity" : 0.75,
"closeOnExit" : true,
"colorScheme" : "Campbell",
"commandline" : ""%PROGRAMFILES%\git\usr\bin\bash.exe" -i -l",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 10,
"historySize" : 9001,
"icon" : "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
"name" : "Bash",
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : true
}
launch git bash with login option

Expected behavior

Be able to see my normal stuff from my ~/.bash_profile. In my case aliases.

Actual behavior

I dont see any of my aliases. It almost feels like the command line args are not being passed to bash. Or, the starting directory is not being passed. If there is a work around, i will do that. i tried creating a .bashrc but this didn't do anything either.

Originally created by @JasperRev on GitHub (Nov 21, 2019). Originally assigned to: @DHowett-MSFT on GitHub. <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment windows 1909 build 18363 ```none Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd] Windows Terminal version (if applicable): Any other software? ``` no # Steps to reproduce I've added this to my profiles.json { "guid": "{00000000-0000-0000-ba54-000000000002}", "acrylicOpacity" : 0.75, "closeOnExit" : true, "colorScheme" : "Campbell", "commandline" : "\"%PROGRAMFILES%\\git\\usr\\bin\\bash.exe\" -i -l", "cursorColor" : "#FFFFFF", "cursorShape" : "bar", "fontFace" : "Consolas", "fontSize" : 10, "historySize" : 9001, "icon" : "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png", "name" : "Bash", "padding" : "0, 0, 0, 0", "snapOnInput" : true, "startingDirectory" : "%USERPROFILE%", "useAcrylic" : true } launch git bash with login option # Expected behavior Be able to see my normal stuff from my ~/.bash_profile. In my case aliases. # Actual behavior I dont see any of my aliases. It almost feels like the command line args are not being passed to bash. Or, the starting directory is not being passed. If there is a work around, i will do that. i tried creating a .bashrc but this didn't do anything either.
claunia added the Needs-Tag-FixNeeds-Attention labels 2026-01-31 00:05:05 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 21, 2019):

I'm surprised that the snippet you've pasted in as your profile actually works without throwing errors 😄

@DHowett-MSFT commented on GitHub (Nov 21, 2019): I'm surprised that the snippet you've pasted in as your profile actually works without throwing errors :smile:
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 21, 2019):

Can you share your complete profiles.json instead of just that snippet? Thanks!

@DHowett-MSFT commented on GitHub (Nov 21, 2019): Can you share your complete profiles.json instead of just that snippet? Thanks!
Author
Owner

@JasperRev commented on GitHub (Nov 21, 2019):

I found it on stack overflow, it was the only one i could find. Is it wrong? is there better guidance? Why would it throw errors?

https://stackoverflow.com/questions/56839307/adding-git-bash-to-the-new-windows-terminal

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation

{
"$schema": "https://aka.ms/terminal-profiles-schema",

"defaultProfile": "{00000000-0000-0000-ba54-000000000002}",

"profiles":
[
    {
        // Make changes here to the powershell.exe profile
        "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
        "name": "Windows PowerShell",
        "commandline": "powershell.exe",
        "hidden": false
    },
    {
        // Make changes here to the cmd.exe profile
        "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
        "name": "cmd",
        "commandline": "cmd.exe",
        "hidden": false
    },
    {
        "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
        "hidden": false,
        "name": "Azure Cloud Shell",
        "source": "Windows.Terminal.Azure"
    },
    {
        "guid": "{00000000-0000-0000-ba54-000000000002}",
        "acrylicOpacity" : 0.75,
        "closeOnExit" : true,
        "colorScheme" : "Campbell",
        "commandline" : "\"%PROGRAMFILES%\\git\\usr\\bin\\bash.exe\" -i -l",
        "cursorColor" : "#FFFFFF",
        "cursorShape" : "bar",
        "fontFace" : "Consolas",
        "fontSize" : 10,
        "historySize" : 9001,
        "icon" : "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
        "name" : "Bash",
        "padding" : "0, 0, 0, 0",
        "snapOnInput" : true,
        "startingDirectory" : "%USERPROFILE%",
        "useAcrylic" : true
    }
],

// Add custom color schemes to this array
"schemes": [],

// Add any keybinding overrides to this array.
// To unbind a default keybinding, set the command to "unbound"
"keybindings": []

}

@JasperRev commented on GitHub (Nov 21, 2019): I found it on stack overflow, it was the only one i could find. Is it wrong? is there better guidance? Why would it throw errors? [https://stackoverflow.com/questions/56839307/adding-git-bash-to-the-new-windows-terminal](url) // To view the default settings, hold "alt" while clicking on the "Settings" button. // For documentation on these settings, see: https://aka.ms/terminal-documentation { "$schema": "https://aka.ms/terminal-profiles-schema", "defaultProfile": "{00000000-0000-0000-ba54-000000000002}", "profiles": [ { // Make changes here to the powershell.exe profile "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", "name": "Windows PowerShell", "commandline": "powershell.exe", "hidden": false }, { // Make changes here to the cmd.exe profile "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", "name": "cmd", "commandline": "cmd.exe", "hidden": false }, { "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}", "hidden": false, "name": "Azure Cloud Shell", "source": "Windows.Terminal.Azure" }, { "guid": "{00000000-0000-0000-ba54-000000000002}", "acrylicOpacity" : 0.75, "closeOnExit" : true, "colorScheme" : "Campbell", "commandline" : "\"%PROGRAMFILES%\\git\\usr\\bin\\bash.exe\" -i -l", "cursorColor" : "#FFFFFF", "cursorShape" : "bar", "fontFace" : "Consolas", "fontSize" : 10, "historySize" : 9001, "icon" : "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png", "name" : "Bash", "padding" : "0, 0, 0, 0", "snapOnInput" : true, "startingDirectory" : "%USERPROFILE%", "useAcrylic" : true } ], // Add custom color schemes to this array "schemes": [], // Add any keybinding overrides to this array. // To unbind a default keybinding, set the command to "unbound" "keybindings": [] }
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 21, 2019):

Ah, the original snippet was missing the escaping on the quotes (\"). That seems like it should work just fine...

Are you using .profile, .bash_profile or .bashrc? They all have different behaviors, and sometimes having one can impact the execution of the others.

@DHowett-MSFT commented on GitHub (Nov 21, 2019): Ah, the original snippet was missing the escaping on the quotes (`\"`). That seems like it should work just fine... Are you using `.profile`, `.bash_profile` or `.bashrc`? They all have different behaviors, and sometimes having one can impact the execution of the others.
Author
Owner

@JasperRev commented on GitHub (Nov 21, 2019):

I am using .bash_profile. I have git bash installed, which i used directly before i was finally able to install windows terminal preview. All my aliases are there. Anyway, that's all i have, and -l and -i doesn't seem to work when executed from within windows terminal -- i mean, the arguments don't seem to be passed??? When i execute the same command -- from a command line like cmd.exe, bash works correctly. So whatever the behavior is taking place in regards to bash profile should be 100% replicated, but my opinion is that the command line args are either not working, i dont have them formatted correctly, or something else. The order in which bash profile or bashrc works doesn't really affect this problem.

@JasperRev commented on GitHub (Nov 21, 2019): I am using .bash_profile. I have git bash installed, which i used directly before i was finally able to install windows terminal preview. All my aliases are there. Anyway, that's all i have, and -l and -i doesn't seem to work when executed from within windows terminal -- i mean, the arguments don't seem to be passed??? When i execute the same command -- from a command line like cmd.exe, bash works correctly. So whatever the behavior is taking place in regards to bash profile should be 100% replicated, but my opinion is that the command line args are either not working, i dont have them formatted correctly, or something else. The order in which bash profile or bashrc works doesn't really affect this problem.
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 21, 2019):

What version of Git for Windows do you have installed, per chance?

@DHowett-MSFT commented on GitHub (Nov 21, 2019): What version of Git for Windows do you have installed, per chance?
Author
Owner

@JasperRev commented on GitHub (Nov 21, 2019):

GNU bash, version 4.4.23(1)-release (x86_64-pc-msys)
i can rule out the command line part of this, i wrote a console app and verified it is passing them. I dont know what i'm doing wrong or where to inject my stuff. It's so not a big deal it would just be nice to have it work with bash out of the box. I'm not on WSL version 2 because i can't run the windows insider at work. When i can, i bet this problem won't matter any more.

@JasperRev commented on GitHub (Nov 21, 2019): GNU bash, version 4.4.23(1)-release (x86_64-pc-msys) i can rule out the command line part of this, i wrote a console app and verified it is passing them. I dont know what i'm doing wrong or where to inject my stuff. It's so not a big deal it would just be nice to have it work with bash out of the box. I'm not on WSL version 2 because i can't run the windows insider at work. When i can, i bet this problem won't matter any more.
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 23, 2019):

It might help you to pass -x to bash as well. When I do that, I get a full (and I do mean full) enumeration of everything it did on startup. That might help you pinpoint what scripts it is running, and that may indicate a reason that it's not running others. How's that sound?

@DHowett-MSFT commented on GitHub (Nov 23, 2019): It might help you to pass `-x` to bash as well. When I do that, I get a full (and I do mean _full_) enumeration of everything it did on startup. That might help you pinpoint what scripts it _is_ running, and that may indicate a reason that it's _not_ running others. How's that sound?
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 23, 2019):

(Alternatively, bash --verbose -i -l will print out the literal scripts that it's running on startup, but holy cow that's even more verbose than -x is.)

@DHowett-MSFT commented on GitHub (Nov 23, 2019): (Alternatively, `bash --verbose -i -l` will print out the literal scripts that it's running on startup, but holy cow that's even more verbose than `-x` is.)
Author
Owner

@JasperRev commented on GitHub (Nov 25, 2019):

@DHowett-MSFT thank you for your time. You are right, that's a lot of options! The output is pretty large, at quick glance not seeing much. But, it's ok. I think i'm the only one with this behavior of not having my profile work. This box is brand new. Appreciate your time.

@JasperRev commented on GitHub (Nov 25, 2019): @DHowett-MSFT thank you for your time. You are right, that's a lot of options! The output is pretty large, at quick glance not seeing much. But, it's ok. I think i'm the only one with this behavior of not having my profile work. This box is brand new. Appreciate your time.
Author
Owner

@neoadventist commented on GitHub (May 15, 2020):

@JasperRev did you ever figure this out? I'm having the same issue.

@neoadventist commented on GitHub (May 15, 2020): @JasperRev did you ever figure this out? I'm having the same issue.
Author
Owner

@neoadventist commented on GitHub (May 15, 2020):

@JasperRev
This worked for me:

            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "Ubuntu",
	 	"fontFace":  "fira code",
		"fontSize": 10,
		"historySize" : 9001,
		"acrylicOpacity" : 0.75,
		"commandline":"bash.exe ~"
            },
@neoadventist commented on GitHub (May 15, 2020): @JasperRev This worked for me: ``` { "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}", "hidden": false, "name": "Ubuntu", "fontFace": "fira code", "fontSize": 10, "historySize" : 9001, "acrylicOpacity" : 0.75, "commandline":"bash.exe ~" }, ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5102