A quick tip!
I just reinstalled Ubuntu WSL on my freshly-formatted laptop. Everything seemed to be working properly but I ran into an annoying problem cloning one of my git repository:
Cloning into 'alessandrococco.gitlab.io' error: chmod on /mnt/c/Users/alessandro/Projects/alessandrococco.gitlab.io/.git/config.lock failed: Operation not permitted fatal: could not set 'core.filemode' to 'false'
It’s weird because it’s the thousandth time that I’ve done it and this is the first time I’ve come across this error!
The problem here is that the content of
/mnt/c is located on a NTFS partition so
chmod doesn’t work.
After some digging in the Microsoft documentation I found a simple solution to this:
- Launch Ubuntu WSL
- Create the file
/etc/wsl.confif it doesn’t exist
- Open the file (e.g.:
nano /etc/wsl.conf) and add the following lines:
[automount] options = "metadata"
- Save the file and shutdown WSL launching
wsl --shutdownfrom a PowerShell
- Relaunch Ubuntu WSL
metadata option allows Windows to support Linux system permissions: now all
chown-related stuff will work correctly!