0

I want to use add . to add all of the files. However, I meet

error: open("project1/codes/Project1/.vs/Project1/v15/Browse.VC.opendb"): Permission denied
error: unable to index file 'project1/codes/Project1/.vs/Project1/v15/Browse.VC.opendb'
fatal: adding files failed

I write a .gitignore, but in vain. I wonder what mistake I have done? enter image description here

Luke
  • 19
  • 3
  • Was `.vs` by any chance already checked in before? If you add it to `.gitignore` after git started tracking it, it won't be ignored. – jingx Mar 20 '21 at 04:03
  • And if `.vs/*` are not already tracked, make sure your `.gitignore` file is plain text in UTF-8, not UTF-16 or some other encoding. – torek Mar 20 '21 at 04:36

3 Answers3

0

Looks like you dont have the permissions.

Check the permissions for that folder or run the command with sudo.

0

I use VSCODE to write a new .gitignore instead of using the Windows notebook. It really works.

I have used PowerShell to like this:

echo ".vs/" >> .gitignore 

this way also has error.

Luke
  • 19
  • 3
0

I think that your .vs folder has already been tracked and that could explain why adding it to the .gitignore file is not enough to prevent it from being added.

You will find in this issue: How to make Git "forget" about a file that was tracked but is now in .gitignore? how to really ignore your folder so that it will not be added by the add . command.

Read carefully to pick the most suitable solution because, depending on your needs, you can untrack the folder or not (both solutions are explained in the issue linked).

Maxime Dezette
  • 126
  • 1
  • 5