How do I change the default location for Git Bash on Windows?
I am using Git on Windows 7 and access my repositories through Git Bash. How can I change the default location that Git Bash opens in a convenient folder when I start it?
It's somewhat time consuming to navigate to htdocs
, and then a specific folder. Is there a way to change the configuration file to have it open elsewhere? Or would it be possible to write a .sh
file to do this?
Unfortunately Git Bash won't open my htdocs
folder shortcut on my desktop, and it takes using cd
5 times to get to my desired directory.
After installing msysgit I have the Git Bash here
option in the context menu in Windows Explorer. So I just simply navigate to the directory and then open Bash right there.
I also copied the default Git Bash
shortcut to the desktop and edited its Start in
property to point to my project directory. It works flawlessly.
Windows 7x64, msysgit.
The easiest way without installing msysgit is right click on the Git Bash shortcut icon → Start in: → "C:\Program Files (x86)".
Change the Start in entry and point out the Git Bash starting position. If you don't remove the --cd-to-home
part from the Target box, the Start in change gets overridden.
Add this line to your .bashrc
file:
cd C:/xampp/htdocs/<name of your project>;
If the .bashrc file doesn't exist, create one in your root folder. For me it is: C:\Users\tapas\
Save .bashrc and open Git Bash. That's it!