Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How do I open a new git bash terminal window at my current location in windows?

Writer Andrew Mclaughlin

When running git bash, I can open a new bash window at my root with Alt+F2

I can open a windows explorer window at the current directory path

$ explorer .

Trying

$ sh

to open a new terminal window at my location just returns

sh: __git_ps1: command not found

and opens the shell in the current window without git running.

How can I quickly open a new bash shell at my location?

5

4 Answers

StuperUser answer is correct, but I want to add that besides adding shell script in a PATH environment it's also possible to add a simple bash alias into .bashrc or .bash_profile files.

Just create alias:

alias git-bash='/git-bash.exe & > /dev/null 2&>1'

bashrc and bash_profile it's a standard BASH configuration files, you can found them in your user home folder.

More information Bash startup files

Since this is specifically for a git-bash terminal, add the Git directory (C:\Program Files\Git) to your path ()

Then run

$ git-bash

to open a new git-bash at the current location.

But to avoid blocking the current terminal it will be necessary to use & > /dev/null 2&>1 to run in the background and pipe the result into null (see ), so added the command to a .sh in the directory to call it simply.

I know this is a couple years old, but I wanted to post this anyways.

When I use @Alex's answer, it seems like each window is attached to the other through linked processes or something. Here is my solution for completely independent new windows that start at the current location.

alias new='start "" "C:\Program Files\Git\git-bash.exe"'

That will get you one new window every time you use it. But I actually like to have 4 terminals open, so I typically use the following alias to open 3 new terminal windows at the current location:

alias new3='start "" "C:\Program Files\Git\git-bash.exe" && start "" "C:\Program Files\Git\git-bash.exe" && start "" "C:\Program Files\Git\git-bash.exe"'

Cheers!

Set the environmental variable pointing to git location C:\Program Files\Git.

Now go to your location in windows where you wanna open git bash.

Press alt + d and type get-bash and you are good to go.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy