Ad

Why Are Some Files Not Recognized By .gitgnore?

- 1 answer

I have taken over a Vue/Gridsome project. The project can be started via the docker-compose.yml file. After booting the node container, all files in the .docker folder (~4000 files) were prepared for the GIT commit.

I then added the .docker folder in the .gitignore. Instead of ~4000 Files there are now only 6 files from the .docker folder. And I wonder why it doesn´t ignore these files although I put the whole folder .docker into the .gitignore folder.

Question: Why are these files not ignored?

My .gitignore

.bash_history (.docker/data/node)
update-notifier-npm.json (.docker/data/node/.config/configstore)
cli.json (.docker/data/node/.config/configstore/[email protected])
anonymous-cli-metrics.json (.docker/data/node/.npm)
565911....de (.docker/data/.npm/index-v5/2b/b7)
30c54c....OO (.docker/data/.npm/index-v5/2b/b7)

.gitignore when i was clone the project

*.log
.cache
.DS_Store
src/.temp
node_modules
dist
.env
.env.*

then i add .docker folder to .gitgnore

.docker
Ad

Answer

Remove files from the Git repository

Adding a file or directory in .gitignore does not remove them from the repository for you, because that might be a costly operation to do.

Files you have already added in the past must be removed again. This way you could set up some output directory with default files, but no additional files are added when the building process is complete.

Consider using git rm:
https://www.atlassian.com/git/tutorials/undoing-changes/git-rm


A file added to the repository is considered tracked. All changes are keeping tracked of.

When people where asking "Please also confirm whether you're already tracking these files." or "Have the files been tracked already?" (@evolutionxbox) they were hinting at exactly that.

Ad
source: stackoverflow.com
Ad