1

I'm working on an Angular app in Visual Studio Code. I also have a remote github repository for this project.

I added Express.js. When I wanted to commit the changes, I got this error when staging the commit:

error: open("AppData/Local/Comms/UnistoreDB/USS.jtx"): Permission
denied error: unable to index file
AppData/Local/Comms/UnistoreDB/USS.jtx fatal: adding files failed

My account has permissions for the file, and it's not being used by another application for as far as I can tell.

Long story short: I tried various ways to fix the issue (incl. moving the app folder && creating a clone of the remote repo, replacing the contents and forcing a push) but my remote repository is now a complete disaster. Oh, and all previous commits seem to have been deleted...

Is there any way for me to:

Get around the permission denied error. Basically overwrite the remote master with the files I currently have, and bring both up to sync?

The Fox
  • 513
  • 3
  • 7
  • 17

1 Answers1

0

If is best in that case to:

  • close the IDE and other windows in order to minimize the number of processes accessing your local clone
  • open an command line in which you can check the state of your repo

A git log could show you your past commit, and you could reset your repo to one of those, where you can see your past content in an acceptable state.
List the files present in a past commit first.

git reset --hard <past-commit>

If you don't care about those past commit, and have a working tree currently with the right content, you simply can simply git add, git commit and git push.
Make sure first that none of your subfolder has its own .git folder in it: you would be trying to add a nested Git repo, which would not work (ie, you would not add its content, only record its tree SHA1: a gitlink)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250