.gitignore whole directory with a space in the name

goal

Trying to ignore the directory with the suspicious name "TextMesh Pro", under the "Assets" folder (full path from the root where .gitignore is located "Sky Labyrinth \ Assets \ Text Mesh Pro \").

Attempt

I followed the offers in 3 threads ( one , two , three ) to no avail.

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 did not expect to work (it really did not work).

Turned off

Files are not cached, I have never done anything from this directory. To be sure, I ran:

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

which did not match anything. To be sure, I ran

 git reset --hard 

and re-import the asset. There is a small caveat, I suppose, I made a fix for the .Unity scene in which there were some objects of the TextMesh Pro game; despite the lack of Git expertise, I’m sure I shouldn’t magically create material inside the Assets \ TextMesh Pro \ directory that will be cached or somehow invulnerable.

Halp

Any ideas on how to properly ignore the entire subdirectory with a space inside the name? I do not need to ignore certain files inside it, I want all this to be ignored. I understand that as a workaround, I could:

  • Manually remove the space from the directory name - but anytime when I update the plugin I have to repeat this

  • Make another .gitignore inside the \ TextMesh Pro \ directory, which ignores everything inside

    / *

    which will be my last resort, as this is the only thing I got to work. However, I would prefer to understand how to properly handle spaces in directory names or find out that this is simply not possible if this is the case.

+5
source share
2 answers

Correct answer:

 TextMesh*Pro/ 

 **/TestMesh Pro/ 

Should also work

+6
source

It seems that you missed one of the gaps between Text and Mesh. Try to add

 Assets/Text\ Mesh\ Pro/ 

on .gitignore

+1
source

Source: https://habr.com/ru/post/1266518/


All Articles