Under Windows 7 I'd like to change the settings for the Git Bash Here shell extension command window, e.g. width, height and font. But when I do this, I get an error "Unable to modify the shortcut".
I can modify the shortcut for Git Bash in the Start menu by using "Run as administrator..." This works, but only for Bash windows opened from the Start menu. It doesn't work for the "Git Bash Here" shell extension and there's no "Run as administrator..." option on right-click context menu.
How do you do it?
2020 Update
KVN posted an update for Windows 10
This one seems to be simplier and works well for me on the latest Git.
Older
If you run git bash as administrator by right clicking on its icon and selecting "Run As Administrator" you will be able to change your settings and have them persist.
You can verify this by closing the admin session then reopening as a normal user.
I did this to set the defaults then just used git as a normal user from then on.
Edit: My answer is outdated if you're using the most recent msysgit version and sebastien.b posted the updated solution with - https://stackoverflow.com/a/7216120/104783
It states
The fix is to edit the
Git Bash.vbs
script and have it execute the link again, instead of sh.exe. Look for this line:
Dim bash : bash = fso.BuildPath(gitdir, "bin\sh.exe")
and replace it with this line:
Dim bash : bash = fso.BuildPath(gitdir, "Git Bash.lnk")
andrej351 also has a good reminder
Also, don't forget to select "Defaults" instead of "Properties" from the drop down menu in order to have the settings persisted
Unfortunately, the accepted answer offered by users sparks or bentayloruk doesn't work anymore (as of git 1.7.6 at least). The Git Bash.vbs
script triggered by "Git Bash Here" doesn't execute the Git Bash
shortcut any longer. It creates a temporary shortcut (.lnk) that executes the bin/sh.exe
executable in the Git install dir instead. Modifying the properties (fonts, color) of either that executable (sh.exe) or the Git Bash shortcut won't help.
The fix is to edit the Git Bash.vbs
script and have it execute the link again, instead of sh.exe. Look for this line:
Dim bash : bash = fso.BuildPath(gitdir, "bin\sh.exe")
and replace it with this line:
Dim bash : bash = fso.BuildPath(gitdir, "Git Bash.lnk")
Update: According to some comments and other answers, this answer is only relevant to older versions. Perhaps those prior to 1.7.6.
Full Instructions
You can modify the settings applied when using the Git Bash Here context menu by doing the following:
C:\Program Files (x86)\Git
.Further Details
This works because clicking the Git Bash Here shell extension menu item runs the command wscript "C:\Program Files (x86)\Git\Git Bash.vbs" "%1"
. This is specified in the registry key HKEY_CLASSES_ROOT\Directory\shell\git_shell\command
. This vbs file sets the current directory and then executes the Git Bash shortcut. Once you have changed the settings on this shortcut, they will always be used when this shortcut is run (regardless of being admin or not).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With