Git clone with Ubuntu WSL, and an error occured.

error: chmod on /mnt/d/nshawn4675.github.io/.git/config.lock failed: Operation not permitted

Because /mnt/d is a NTFS partition so that chmod doesn’t work.

Steps to solve this problem:

  1. Launch Ubuntu WSL
  2. Create / Modify WSL conf file

     $ sudo vi /etc/wsl.conf
        
     [automount]
     options = "metadata"
    
  3. Shutdown WSL with PowerShell

     wsl --shutdown
    
  4. Relaunch Ubuntu WSL

Reference