.gitignore名称中带有空格的整个目录 [英] .gitignore entire directory with whitespace in name

查看:425
本文介绍了.gitignore名称中带有空格的整个目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图忽略名称为"TextMesh Pro"的恼人目录,该目录位于资产"文件夹下(.gitignore所在根的完整路径为"Sky Labyrinth \ Assets \ Text Mesh Pro \").

Trying to ignore the annoyingly-named "TextMesh Pro" directory, underneath an "Assets" folder (full path from the root where .gitignore resides is "Sky Labyrinth\Assets\Text Mesh Pro\").

我在3个线程中遵循了建议(一个两个三个)未成功

I followed the suggestions in 3 threads (one, two, three) unsuccessfully.

在实际的.gitignore文件中,我尝试过:

In the actual .gitignore file I tried:

TextMesh Pro/
TextMesh\ Pro/
**/TextMesh Pro/
**/TextMesh\ Pro/
\Assets\TextMesh Pro\
\Assets\TextMesh/ Pro\
**\Assets\TextMesh Pro\
**\Assets\TextMesh/ Pro\
"\TextMesh Pro\"
"**\TextMesh Pro\"

还有其他一些我没想到的组合(确实没有用).

And a bunch of other combinations that I didn't expect to work (that did indeed not work).

文件未缓存,我从未提交过该目录中的任何内容.只是为了确定,我跑了:

The files are not cached, I have never committed anything from that directory. Just to be sure, I ran:

git rm -r --cached "Sky Labyrinth\Assets\Text Mesh Pro\"

与任何内容都不匹配.可以肯定的是,我跑了

which did not match anything. Just to be doubly sure, I ran

git reset --hard

并重新导入资产.我想有一个小小的警告,我确实做了一个.Unity场景更改,里面有一些TextMesh Pro游戏对象.尽管我缺乏专业的Git知识,但我敢肯定,不应神奇地使Assets \ TextMesh Pro \目录中的内容被缓存或以某种方式不可忽略.

and re-imported the asset. There is a minor caveat I guess, I did commit a .Unity scene change that had some TextMesh Pro gameobjects inside it; despite my lack of expert Git knowledge I'm pretty sure that shouldn't magically make stuff inside the Assets\TextMesh Pro\ directory get cached or somehow un-ignorable.

关于如何正确忽略名称中带有空格的整个子目录的任何想法?我不需要忽略其中的特定文件,而是希望忽略整个内容.我了解作为一种解决方法,我可以:

Any ideas on how to correctly ignore an entire sub-directory that has whitespace inside the name? I don't need to ignore specific files inside it, I want the whole thing ignored. I understand that as a workaround I could either:

  1. 从目录名称中手动删除空格-但是每当我更新插件时,我都必须重复此操作

  1. Manually remove the whitespace from the directory name - but anytime I update the plugin I have to repeat this

在\ TextMesh Pro \目录中创建另一个.gitignore,它会忽略其中的所有内容

Make another .gitignore inside the \TextMesh Pro\ directory that ignores everything inside with

/*

这是我的最后一招,因为这是我唯一要做的事情.但是,我更希望了解如何正确处理目录名称中的空格,或者了解在这种情况下根本不可能做到这一点.

which will be my last resort since it's the only thing I've gotten to work. However I'd prefer to understand how to correctly deal with whitespaces in directory names, or learn that it's simply not possible if that's the case.

推荐答案

正确的答案是:

TextMesh*Pro/


**/TestMesh Pro/

应该也可以

这篇关于.gitignore名称中带有空格的整个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆