I am loosing a lot of time searching in internet for the following simple setting.
I installed git (and git bash) in Windows. What I want is just to open Git Bash and be in the directory I want. I don't want to change my home directory, just be in a given directory when I open the program.
More detailed, when I open Mingw / Git bash in Windows, I would like to be in the following folder:
/c/blabla/my_git_repositories
(this corresponds to the windows-style path: C:\blabla\my_git_repositories).
At the moment, I must write the following command every time I open GitBash:
cd /c/blabla/my_git_repositories
is this possible? Which file should i modify?
Actually the program is installed here:
C:\Program Files\Git\mingw64
Thanks
If you want it happening every time you start an interactive shell, add
to your shell startup. If your install includes the manpages say
man bashand find theINVOCATIONsection, in a decent pager just/^INVwill do it. Or Google knows to interpret a search forman bashas a search for the bash manpage.Windows doesn't ordinarily support shell logins at all so a lot of the shell's startup-circumstance detection is overkill on Windows. Executing it is extremely fast, but describing exactly how it decides takes a page or two.
The short form is, if the startup was told it's a login shell it reads the login startup files, including (your)
~/.bash_profile, which generally should check for an interactive login and if so source the normal interactive shell startup~/.bashrc, so~/.bash_profileshould end with something likeand put whatever you want in
~/.bashrc. Thatcd, set up your prompt colors, define your favorite shell aliases, add your personal scripts directory toPATH, whatever.