Reputation: 53
I added .vscode/
to .gitignore
but I can still see it in git status
as Untracked. I have neved committed it before so it's not a key of the problem.
If i try to remove it from index by git rm --cached .vscode
, i get an error: fatal: pathspec '.vscode' did not match any files
.
I tried to remove and recreate .vscode/
in order to force .gitignore
to start working but it didnt help.
Have this problem with some other dirs aswell.
UPD:
.gitignore
location: D:\Git\.gitignore
.gitignore
content: https://i.sstatic.net/MTwql.pngD:\Git
.vscode/
location: D:\Git\.vscode
UPD1:
$ git status -uall
On branch opkm-pay-delay
Untracked files:
(use "git add <file>..." to include in what will be committed)
.vscode/.ropeproject/config.py
.vscode/.ropeproject/objectdb
.vscode/settings.json
Empty results of git check-ignore:
Paliyuk-PA@Paliyuk-PA MINGW64 /d/Git (opkm-pay-delay)
$ git check-ignore -v .vscode/.ropeproject/objectdb
Paliyuk-PA@Paliyuk-PA MINGW64 /d/Git (opkm-pay-delay)
$ git check-ignore -v .vscode/settings.json
Paliyuk-PA@Paliyuk-PA MINGW64 /d/Git (opkm-pay-delay)
$ git check-ignore -v .vscode/.ropeproject/config.py
Upvotes: 1
Views: 1729
Reputation: 488123
OK, from this:
$ git status -uall On branch opkm-pay-delay Untracked files: (use "git add <file>..." to include in what will be committed) .vscode/.ropeproject/config.py .vscode/.ropeproject/objectdb .vscode/settings.json
we know which files are problematic, and from this:
Paliyuk-PA@Paliyuk-PA MINGW64 /d/Git (opkm-pay-delay) $ git check-ignore -v .vscode/.ropeproject/objectdb
[results in no output]
we know that the .vscode/
line (line 106 in the linked image) is not taking effect. Finally, from this comment, I know what the actual problem is:
Also i found out that the old (broken) file weights almost twice as much as the new good one while their "text" content is the same.
The .gitignore
file that isn't working is encoded in UTF-16 (probably UTF-16-LE, because Windows). Git doesn't read such files. Git expects the .gitignore
contents to be UTF-8. So, none of the UTF-16 content ends up actually working.
Recopying the contents to a new file apparently wrote out the new .gitignore
as UTF-8, so that Git could read and understand it. Windows probably also has file-conversion tools, although since I avoid Windows, I'm not sure what they might be.
Upvotes: 3
Reputation: 53
I have just moved my .gitignore
file to another dir, created a new empty one in my D:\Git
, copy pasted the content of the original file to the new one and, for some reason, it finally worked!
So the answer is to recreate your .gitignore
file :|
Upvotes: 0