25

Goal

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\").

Attempted

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

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).

Ruled Out

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

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.

Halp

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. Manually remove the whitespace from the directory name - but anytime I update the plugin I have to repeat this

  2. 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.

Community
  • 1
  • 1
Murkantilism
  • 1,060
  • 1
  • 16
  • 31
  • See also: https://stackoverflow.com/questions/10213653/gitignore-ignore-files-within-a-folder-that-has-whitespace-in-the-middle – behnam Oct 12 '17 at 19:48
  • Possible duplicate of [gitignore ignore files within a folder that has whitespace in the middle](https://stackoverflow.com/questions/10213653/gitignore-ignore-files-within-a-folder-that-has-whitespace-in-the-middle) – behnam Oct 12 '17 at 19:48

5 Answers5

29

Correct answer is:

TextMesh*Pro/

**/TestMesh Pro/

Should also work

Murkantilism
  • 1,060
  • 1
  • 16
  • 31
  • 5
    If `TextMesh Pro/` doesn't work and `TextMesh*Pro/` does work, then most likely the space in the directory name is not really a space, or there's more than one space. – 1615903 Apr 10 '17 at 05:45
  • 4
    This ignores any directory that matches `TextMesh*Pro` recursively from the `.gitignore`. Ie. `TextMesh_Pro/`, `TextMeshAPro/` etc. This answer is incorrect – CervEd Dec 29 '21 at 14:07
  • `TextMesh*Pro/` that is abuse of wildcard. It will even ignore `TextMesh dumdum Pro/` – Rajesh Swarnkar Aug 13 '22 at 13:56
7

It seems that you have missed one of the spaces between Text and Mesh. Try adding

Assets/Text\ Mesh\ Pro/

to your .gitignore

2

Add to Sky Labyrinth\Assets\.gitignore

/TextMesh\ Pro/

"Trying to ignore the annoyingly-named "TextMesh Pro" directory"

  • / matches a literal path, not a pattern
    is escaped using \ -> \

"underneath an "Assets" folder"

  • put the .gitignore in Assests
CervEd
  • 3,306
  • 28
  • 25
1

If the files in question are in your git repo, you'll need to delete them and push that change before the .gitignore will work.

Bennett
  • 11
  • 1
0

In my project, the TextMesh Pro folder is inside the Assets folder. Adding the following line to my .gitignore worked for me:

/Assets/TextMesh\ Pro/