Can't clone repository from mounted drive

Kurt Maurer picture Kurt Maurer · Oct 17, 2018 · Viewed 12.1k times · Source

I am using Windows Subsystem for Linux (WSL) and have a mounted microSD card that I've been able to clone repositories into in the past. Recently, however, I am receiving this error when I try to clone from /mnt/d/:

Cloning into 'your_repo'...
error: chmod on /mnt/d/your_repo/.git/config.lock failed: Operation not permitted
error: chmod on /mnt/d/your_repo/.git/config.lock failed: Operation not permitted
error: chmod on /mnt/d/your_repo/.git/config.lock failed: Operation not permitted
error: chmod on /mnt/d/your_repo/.git/config.lock failed: Operation not permitted
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

If I change into any directory on /mnt/c/ I can clone perfectly fine. When I clone I use SSH if that helps. Thank you.

Answer

VonC picture VonC · Oct 17, 2018

Considering changes to Chmod/Chown WSL Improvements, you could try, as in WSL issue 3172

sudo umount /mnt/d
sudo mount -t drvfs D: /mnt/d -o metadata