title: How to change ownership of a local GIT repository on Windows 11
body: <p>I am a relatively new/light GIT user. I use a local git repository to backup my code and I have not setup a remote repository on github.com or any other remote repository hosting system. I am working on Windows 10 &amp; Windows 11 machines.</p>
  <p>I created a local git repository using <code>git init</code> which created a <strong>.git</strong> folder under my project directory. I moved the <strong>.git</strong> folder so created to a USB thumb drive (D:) and renamed it <strong>myrepo</strong>. In my project directory I created a <em>.git</em> file with the setting <code>gitdir: D:/myrepo</code>. My though process was in case my C: drive fails I will have my local repository safe on the USB thumb drive as I have not setup a remote repository. All worked well with this setup.</p>
  <p>Now I have a new machine (Windows 11). I copied my project code to the new machine and plugged in the USB thumb drive (D:). However when I execute any git commands I get an error -- <em>fatal: detected dubious ownership in repository....</em>. After some research I found out that due to a recent git security vulnerability an update to git causes it to check for repository ownership before executing commands.</p>
  <p>One easy solution is to add a <strong>safe.directory</strong> setting <code>git config --global -add safe.directory &lt;project directory&gt;</code>. But I am trying to get to the bottom of this. ON WINDOWS PLATFORM - How does git know the owner of the local repository? As mentioned the local repository is on a USB thumb drive which is a FAT32 partition and does not have any kind of file ownership. So how does git know the repository was created by some other user? Also is there a way to change the ownership of the git local repository so that I don't have to use the <strong>safe.directory</strong> setting.</p>
  <p>Thank you in advance for any help the community can offer.</p>