jboxxx
jboxxx

Reputation: 747

/ directory for git bash on windows

So I've recently moved from a macOS terminal to git bash for Windows and I'm confused by what git bash is showing as my root directory or specifically the directory at /.

All of my data is stored in my /c/ directory at /c/Users/myUSER. And that's fine with me.

Now when I, $ cd / and subsequently $ ls, I see all of the below folders that I was used to on my Mac, but /c/ is not visible!

myUSER /
$ ls
bin/  etc/           LICENSE.txt  ReleaseNotes.html  unins000.exe*
cmd/  git-bash.exe*  mingw64/     tmp/               unins000.msg
dev/  git-cmd.exe*   proc/        unins000.dat       usr/

And now I am very surprised I can do the following:

myUSER /
$ cd c
myUSER c
$

Can someone please explain this behavior?

Upvotes: 1

Views: 1487

Answers (1)

VonC
VonC

Reputation: 1328602

This originally comes from MSYS2, as described in git-for-windows/git issue 111:

The post-install scripts that are part of the filesystem package are not included in the release builds. Three of them are useful:

  • 01-devices.post sets up various folders and symlinks inside /dev, notably including /dev/fd, which is required for Bash process substitution to work.
  • 03-mtab.post creates /etc/mtab as a symlink to /proc/mounts.

(that is where the drives are listed/available)

  • 06-windows-files.post creates the hosts, protocols, services, and networks files in /etc by copying them from C:\Windows\system32\drivers\etc.

As a side note, the symlinks it creates are not true symlinks but Cygwin's fancy pseudo-symlinks, so creating them does not require admin privileges.

Upvotes: 1

Related Questions