77

I have a folder that have a space in the middle, but have a webconfig file inside it. I want git to ignore the webconfig file but somehow it's not ignoring it because of the space in the folder. Anybody know how to work around this?

My FolderName/Web.config

I tried to insert the %20 in the middle but that did not help.

Thank you for your help.

behnam
  • 1,959
  • 14
  • 21
Master Page
  • 823
  • 1
  • 6
  • 9

2 Answers2

96

Try My\ FolderName/Web.config or "My FolderName/Web.config"

buræquete
  • 14,226
  • 4
  • 44
  • 89
ch3ka
  • 11,792
  • 4
  • 31
  • 28
  • 32
    My\ FolderName/Web.config worked for me. "My FolderName/Web.config" did not work for me. – Steve Dec 03 '12 at 15:52
  • On Windows, `My\ FolderName` worked for me as well. Thanks! – Analytical Monk May 17 '16 at 07:16
  • 14
    For me none of your methods worked on windows 10 64bit. – Black May 26 '18 at 10:40
  • For me, windows requires the latter and linux the former. If you have to support both (I do), I'm not sure what you are supposed to do. – aggieNick02 Dec 12 '18 at 22:40
  • 3
    Also, it would appear, that if a file is already tracked, just putting it in .gitignore will not stop tracking it. You need to add the file to ignore to .gitignore, then remove it from the local system, let the removal propogate to the origin, then put the file back in the local system. I'm sure there is a more efficient way, but however you do it, you need to undo the existing tracking in addition to getting the pattern right in the .gitignore file. – James Madison Jun 25 '19 at 08:37
  • 1
    @aggieNick02 Since there's nothing wrong in having unused rules in your `.gitignore`, you could put both forms and it'll work fine. – brainplot Sep 20 '19 at 22:50
  • 3
    @JamesMadison `git rm` or `git rm --cached` to untrack a now-ignored file which was previously added to tracking. – orion elenzil Jun 21 '21 at 18:50
  • Backslash-escaping worked for me both on Linux and Windows 10. Using the file path without escaping or quoting also worked on both. Quoting did not work on either. – Dominik Nov 02 '21 at 16:17
-4

I'm guessing you probably have to use "My FolderName"/Web.config instead.

lrAndroid
  • 2,834
  • 18
  • 27