Windows 版 Git Bash 不显示所有目录
我运行的是 Windows 10.0.19043。我有最新版本的 Git Bash。我正在尝试将本地存储库推送到 Github,但是当我在 Git Bash 中 cd
到存储库的根目录并运行 ls
时,出现的唯一子目录是node_modules
(public
和 src
丢失)
当我使用文件资源管理器导航到同一项目根目录时,public
> 和 src
显然在那里,以及它们的所有内容。
此外,我的桌面上有很多目录,但是当我在桌面上使用 Git Bash 中的 ls 时,这个特定的项目文件夹是它唯一显示的目录。
知道是什么原因造成的吗?如果需要更多信息,请告诉我。
I'm running Windows 10.0.19043. I have the latest version of Git Bash. I'm trying to push a local repository to Github, but when I cd
to the repository's root directory in Git Bash and run ls
, the only child directory that comes up is node_modules
(public
and src
are missing)
When I use the file explorer to navigate to the same project root, public
and src
are clearly there, along with all of their contents.
Additionally, I have many directories on my Desktop, but when I use ls
from Git Bash at the Desktop, this particular project folder is the only one that it displays.
Any idea what could be causing this? Please let me know if more information is needed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Windows 限制大多数程序对某些目录(例如“文档”文件夹)的访问,除非它们有权访问并请求访问。这意味着像 Git 这样的程序将无法访问这些文件夹下的所有文件和目录。
因此,您应该避免将 Git 存储库放置在桌面、文档、音乐或其他类似文件夹下。此外,切勿将 Git 存储库存储在由云同步服务(例如 Dropbox 或 OneDrive)管理的目录下,因为这可能会导致数据丢失或其他数据丢失。由于这些文件夹通常由此类程序管理(如果您正在使用它们),因此这是避免使用它们的另一个原因。
您可能最好将存储库移动到主目录中(例如,在
C:\Users\
下),然后事情可能会起作用。Windows restricts access to certain directories, such as the Documents folder, to most programs unless they have access and request it. This means that programs like Git won't have access to all the files and directories under those folders.
As a result, you should avoid placing Git repositories under the Desktop, Documents, Music, or other similar folders. In addition, you should never store Git repositories under a directory managed by a cloud syncing service, such as Dropbox or OneDrive, since this can cause missing data or other data loss. Since those folders are often managed by these sorts of programs (if you're using them), this is another reason to avoid them.
You're probably better moving your repositories into your home directory (e.g., under
C:\Users\<username>
), and then things will probably work.