Git file permissions on WSL

Due to how docker volumes are mounted on Windows, I had to checkout git repositories on Ubuntu WSL to the Windows directory mount, eg. /c/workspace/...

File permissions don't translate well from Linux to Windows, hence, the git files have their permissions "changed" to 755, which is the default mounted permissions. Now when viewing changes from WSL, it is crowded by these "changes", which makes it hard to do git add . without adding all the unchanged files.

The way is to add a git config on WSL to ignore the file permission changes

git config --global core.filemode false

If you need to change permission on a file in the future, eg. add an executable bit

git update-index --chmod=+x 'scriptname.ext'

It takes an extra step to remember, but it doesn't happen too often so I'm okay with it.

Show Comments