git will not ignore a file that’s already tracked before a rule is added to this file to ignore it. In such a case, the file must be un-tracked with git rm --cached <filename>.
So, if you are trying to ignore this file newly, run this: git rm --cached web.config.