I\'m using VS Code with Git - it\'s in portable location C:\\_DEV\\bin\\git and is also added to Windows PATH so it works just fine with no remotes.
I have a OneDriv
I have had this error a lot recently, and the above answers helped, but another thing that also seems to cause it is VS itself running.
Try closing VS, then doing a "Git Bash Here" from Explorer and using the command line only.
Once done you can then reopen VS.