简体   繁体   English

Windows上git bash的/目录

[英]/ 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 / . 因此,最近我已经从macOS终端迁移到Windows的git bash,我对git bash显示为根目录或/的目录感到困惑。

All of my data is stored in my /c/ directory at /c/Users/myUSER . 我所有的数据都存储在/c/目录中的/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! 现在,当我输入$ cd /并随后输入$ ls ,我看到了我在Mac上习惯使用的以下所有文件夹,但是/c/不可见!

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? 有人可以解释这种行为吗?

This originally comes from MSYS2, as described in git-for-windows/git issue 111 : 这最初来自MSYS2,如git-for-windows / git问题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. 01-devices.post在/ dev内设置了各种文件夹和符号链接,特别是包括/ dev / fd,这是Bash进程替换起作用所必需的。
  • 03-mtab.post creates /etc/mtab as a symlink to /proc/mounts . 03-mtab.post创建/etc/mtab作为/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 . 06-windows-files.post通过从C:\\Windows\\system32\\drivers\\etc复制来在/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. 附带说明一下,它创建的符号链接不是真正的符号链接,而是Cygwin的奇特的伪符号链接 ,因此创建它们不需要管理员权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM