41

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 /).

5
  • 9
    Try running mount in the the bash shell.
    – DavidPostill
    Mar 26, 2017 at 17:54
  • 1
    @LazyBadger OK so according to Git Bash Properties (I right-clicked on Git Bash), it starts in C:\Program Files\Git\ . This still doesn't answer why / has a proc subdirectory and C:\Program Files\Git\ doesn't. Do you know? Mar 27, 2017 at 5:05
  • @DavidPostill Thanks, this also corroborates this. mount gives the line: C:/Program Files/Git on / type ntfs (binary,noacl,auto). But why does / have a proc subdirectory that C:\Program FIles\Git\ doesn't have then? Mar 27, 2017 at 5:08
  • 2
    Again: tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html "/proc is very special in that it is also a virtual filesystem. It's sometimes referred to as a process information pseudo-file system. It doesn't contain 'real' files but runtime system information (e.g. system memory, devices mounted, hardware configuration, etc)." Mar 27, 2017 at 8:39

6 Answers 6

60

In Git Bash, open Windows Explorer with this command:

explorer .

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

2
  • 6
    excellent answer : simple and actually works for any folder. With this I discovered that /tmp was mounted for c:/users/[my winuser]/[local app data folder]/temp
    – Pacopaco
    Jun 12, 2019 at 7:48
  • Mine was at C:\Users\Administrator\AppData\Local\Temp\2
    – Lenne
    Jan 12 at 12:16
12

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.)

1
  • Do you have advice on the opposite conversion? I.e. I am having trouble navigating to some of the standard Windows paths on the Linux prompt (e.g. how do I cd to C:\Program Files ?)
    – Ben Farmer
    Oct 29, 2020 at 2:59
1

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

0

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\

1
  • That doesn't make any sense unless you've modified the install. If you haven't modified your install / isn't where you think it is. Nov 20, 2021 at 4:14

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.