62

When I open Git Bash on Windows 7, the default directory is /. It has *nix-style subdirectories, and cd .. doesn't change the directory. Where is this directory on my Windows machine?

The directory C:\Program Files\Git\ has similar contents, except that / has a proc subdirectory, and C:\Program Files\Git\ doesn't.

I put dir /s /a git-bash.exe in cmd.exe, and it only came up with the git-bash.exe in C:\Program Files\Git, no other one (such as the one in /).

6 Answers6

91

In Git Bash, open Windows Explorer with this command:

explorer .

You will then see your current directory in the explorer address bar

Gary Barrett
  • 5,498
13

You can run cmd from the current directory in Git Bash. That will start a windows cmd shell, which will show the windows path in the command prompt. Then type exit to return to Git Bash.

For example:

$ cmd
Microsoft Windows ...

C:\Program Files\Git>

(This is also a quick way to convert unix path to windows path.)

wisbucky
  • 3,346
6

cd / && pwd -W | sed 's/\//\\/g'

$ echo "$(cd / && pwd -W | sed 's/\//\\/g')"
C:\Users\EXAMPLEUSER\Documents\PortableGit

Explanation:

Changing directory to root directory '/' will take you to where git was installed. The conventional "$PWD" variable won't provide much help as it says '/' too. To get the true working directory, the command pwd followed by the -W argument is required

-W print the Win32 value of the physical directory

This alone will print the correct and full directory, however it uses the Unix '/' separator between directories which Windows may not use system-wide, so the sed command edits the '/'s to '\'s

2

Thank @GaryBarrett for his/her nice hint.

In git-bash:

cd /bin
start .
0

if you using Far Manager it's possible to find an application/file by pressing Alt-F7 then bash.exe in the search field. Second, need to select the Select search area parameter to In PATH Foldersenter image description here.

This will be helpful if you accidentally install more bash installations than one.

-1

if on my computer with windows it is here: C:\Program Files\Git\mingw64\bin

or this is the default location C:\Program Files\Git\mingw64\

gUfriL
  • 101