While working on one of my projects I manually moved some files around and made some changes to the file structure. After doing this I and adding a new project I wanted to commit these new files and structure to Git, I then received this message:
“Git failed with a fatal error.error: open(".vs/XXXXXX/v15/Server/sqlite3/db.lock"): Permission denied fatal: Unable to process path .vs/XXXXXX/v15/Server/sqlite3/db.lock”
On the first time receiving this error I simply went to my .vs/XXXXXX/v15/Server/sqlite3 folder and deleted the db.lock file and committed my files to Git and it worked.
I continued with writing more code for this new project and then proceeded to commit these new code changes and I ended up with the same error message again. This was going to be an annoyance during development so I needed to find a solution.
The solution was that while I had moved files around I had removed my .gitignore file. This file tells Git what files to ignore when performing a commit to the server.
There are a couple of ways of replacing this file in your project. One way is to download a template for Visual Studio from GitHub’s collection of .gitignore templates @ https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
Another way is to add it through your Team Explorer window in Visual Studio
1. On the Team Explorer’s window, go to Settings
2. Then click on Repository Settings
3. Finally, click the Add in the Ignore File section
Now you are done.
This default file includes the .vs folder and will solve the issue of the locking of the files.