5

I'm trying to remove my web.release.config from my GIT repository, so I removed it from git with git rm and then added it to my .gitignore file.

But as soon as I copy again the file into the project, it gets added by Visual Studio to the pending changes.

This is the line in the gitignore file:

Web.Release.config

But it gets added:

enter image description here

enter image description here

How can I successfully remove web.release.config from git?

2
  • You have no trailing characters there?
    – Zlatko
    Commented Oct 10, 2014 at 13:17
  • Not one, checked multiple times
    – Escobar5
    Commented Oct 14, 2014 at 13:58

3 Answers 3

8
+25
  • After adding files to the .gitignore file, to ignore those files we have to execute some commands.
  • To ignore the files which we mentioned in the .gitignore file, we have to execute the following commands.

    git rm -r --cached . git add . git commit -m ".gitignore is now working"

  • Please refer this question once.

6
  • The file is already removed from the repository, also git doesn't show it in 'git status'. It is visual studio that is trying to add it.
    – Escobar5
    Commented Oct 7, 2014 at 14:20
  • please check whether this file 'Web.Release.config' exists in your project folder. and add entire path of your file in '.gitignore' file. Commented Oct 8, 2014 at 4:35
  • Yes it exists, as you can see in the pictures above. I've also tried with the full path of the file, no success
    – Escobar5
    Commented Oct 8, 2014 at 13:30
  • after adding that file path in .gitignore execute above three commands once. Commented Oct 8, 2014 at 14:02
  • Yes, I've already done that, the file is not in the repository
    – Escobar5
    Commented Oct 9, 2014 at 14:14
2

This might not be a "proper" answer, but I think it's Visual Studio messing around. I've been experiencing the same problem with Visual Studio 2013 when I tried to exclude NuGet packages from the repository. git status shows nothing, while VS still shouting that there're hundreds of files pending to be added. I ended up just use a Git Client (Git Extension, which is bundled with the git installation package) and ignore that Team Explorer tab in VS completely.

1
  • Yes, it definitely seems to be a problem with VS
    – Escobar5
    Commented Oct 10, 2014 at 14:25
-1

Open your .gitignore file in a real text editor and verify that the encoding is UTF-8. Other encoding (eg: UTF-16LE) may cause this problem.

1
  • It was in another encoding, but I've already changed it and no effect
    – Escobar5
    Commented Oct 10, 2014 at 14:25

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.