80

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.

2
  • you could use a * or do you want to force that there is a whitespace?
    – Stephan
    Apr 18, 2012 at 16:25
  • Just in case anybody stumbles across this and wonders why %20 won't work, it's because %20 is unique to URL encoding. Nov 4, 2018 at 6:13

2 Answers 2

98

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

8
  • 33
    My\ FolderName/Web.config worked for me. "My FolderName/Web.config" did not work for me.
    – Steve
    Dec 3, 2012 at 15:52
  • 14
    For me none of your methods worked on windows 10 64bit.
    – Black
    May 26, 2018 at 10: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. Jun 25, 2019 at 8: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, 2019 at 22:50
  • 3
    @JamesMadison git rm or git rm --cached to untrack a now-ignored file which was previously added to tracking. Jun 21, 2021 at 18:50
-4

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.