I wanted to ignore the entire .vs folder because I was getting a locked/permission denied error on sqlite3/db.lock found in the .vs folder, so I created a .gitignore file with this bash command:
touch .gitignore
and then added this line inside of the .gitignore file:
.vs/*
But I still got the same error when I run git add --all.
In the end, I opened Sourcetree app, ignored the .vs folder content by right clicking the files and choosing ignore, and then I managed to add all the files, commit and push (through the Sourcetree app).
Not pleased with this solution because I wanted to do everything through command line. Now I am wondering why has the gitignore content not changed if I supposedly have manipulated it through Sourcetree? And how can I add files to .gitignore? What I did didn't seem to have any effect (the fact that I added line .vs/*)
1 Answer
What you did had an effect. Namely that all future changes will be ignored.
The issue here is that when you add files to .gitignore they will be ignored from any changes you make but they will still remain in the repository. What you need to do is remove everything from git and add them again. This way the files you want ignored won't be added.
You can do this with the following commands:
git rm -r --cached .
git add .
git commit -m ".gitignore fix"Reference:
8