I recently had my main hard drive fail (GJ Sabrent) and had to reinstall windows from scratch on a new drive. I had been storing all my GIT projects for VS and VSCode on a second SSD with bitlocker encryption. Upon opening projects and trying to access GIT functions i am receiving the following error even though the .git/
directory is still present.
git log failed with code 128: fatal: not a git repository (or any of the parent directories):
Additionally when i try to build or edit files i continually run into random issues with write permission denied in both VS and VSCode.
Upon looking at the permissions for the root folder for the drive i see that the ownership still refers to the old user on the old machine.
Looking around i see that there are a couple ways to solve this.
Restoring file permissions for the whole tree
icacls.exe .\Users_old\ /reset /t /c /l
Or this method from here (https://community.spiceworks.com/topic/2060659-take-ownership-grant-permission-recursively-with-icacls-takeown)
takeown /R /A /F .\Users_old\ /D N
icacls foldername /grant Administrators:F /T /C
I've tried both of them and now the permissions for the folders look correct. But it is still not seeing the .git
directory.
I've tried cloning a repo again in a new top level folder on the drive and that is also having problems with permission denied.
Does the .git
directory need some special permissions? Is there a way to reset all of them on a drive? Is there a way to take ownership of a drive and fix all the permissions recursively?
EDIT: BTW this is on Windows 11.