Unable to delete .gitconfig folder in user home wsl2
I want delete the .gitconfig folder in my user's home directory on Ubuntu 20-.04 (WSL2) but I'm getting this strange error:
rm: cannot remove '.gitconfig/': Device or resource busy
I've tried testing through lsof but no results show up.
I had the same issue: I could delete this folder from Windows, by going to \\wsl$\Ubuntu-20.04\home\<my_username>
and deleting .gitconfig
folder, but it was immediately recreated.
Turns out that what was keeping it busy is the Docker integration for WSL2.
I stopped the (Windows) process, and I was able to rm -R ~/.gitconfig
from windows.
I then created the file ~/.gitconfig to prevent Docker from repeating this nasty behavior