GitHub Desktop gets confused on file permissions (x-bit) in WSL
See original GitHub issueDescribe the bug
GitHub Desktop mistakenly marks files which have the x-bit set (mode 0755 on MacOS and Linux) as changed when the checked out repo is on a WSL “share”.
Version & OS
GitHub Desktop 2.4.0, Windows 10 Pro, WSL 2 (Windows preview “slow” channel)
Steps to reproduce the behavior
- Open WSL 2
- go to a directory on a non-Windows location, e.g. your WSL home directory, not “
/mnt/c/Users/xyz
”. - Do a “
git clone
” of any repository containing executable scripts, such as shell scripts or Python programs. - Ensure the files have the 0755 mode, aka “rwxr-xr-x” and that this is the mode of the file on GitHub in the rep. Use “
git ls-files -s
” to verify. - Open GitHub Desktop, and add the repo as a local repo. It will be under “
\\wsl$\home\<user>
”. - The error: GitHub Desktop will show all scripts as “Changed files”, even though nothing was actually changed. Running “
git status
” on the WSL commandline will show that actually nothing has changed.
Expected behavior
GitHub Desktop should show that nothing has actually changed.
Actual behavior
GitHub Desktop shows files as changed and wants them to be checked in.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:18 (1 by maintainers)
Top Results From Across the Web
Make GitHub Desktop work from WSL on Linux repositories
When I add Linux repositories to GitHub, it recognizes them, but it gets confused with file names and line endings between Linux and...
Read more >Unable to change file permissions on Ubuntu Bash for ...
Now you are all set; changing permissions of a file in Windows from /mnt/c/ will be reflected, and mounted, correctly within WSL on...
Read more >How do I change file permissions for a new file committed onto ...
I added a new shell script to my repo, which I committed and pushed onto my app via Github Desktop, which is on...
Read more >Fix Windows Subsystem for Linux (WSL) File Permissions
Windows 10 is my daily driver at home so I need a way to use some Linux command-line utilities (e.g. git) without having...
Read more >GitHub Desktop now shows pull request check run statuses
GitHub Enterprise Cloud users can now configure two new permissions when managing custom repository roles: View secret scanning results; Dismiss ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is what I did to solve this.
git config --global core.fileMode false
git config --global core.fileMode true
. Also, in case you didn’t have this setting when cloning repositories on WSL, you need to disable explicitly it per repository:git config --local --unset core.fileMode
. According to the docs:After this, I no longer see changes caused by filemode changes done in WSL at GitHub Desktop. Note the “false” changes are also reported when running a simple
git diff
on Windows Git, so I don’t think this is really a Desktop bug.@outofambit This was a learning trajectory for me too. I found out that the “
\\wsl$\<distro-name>
” prefix will give you a pseudo-SMB share of the WSL2 filesystem, with all the consequences of such shares: File protection bits are not propagated properly, so if you run Windows-git on it, you should prevent trouble and disable the filemode bits.That said, if you could actually use the “
wsl
” prefix and run Linux Git on the actual underlying filesystem. So, if GitHub Desktop on Windows wants to properly support WSL(2), you should replace the running of Windows Git with Git-for-Linux using the WSL prefix. So the “Add repository” dialog must allow the user to select “WSL filesystem”, with a drop-down of the Distros. Then you know you can access the files directly using “\\wsl$\<distro-name>
” and adjust all runs of CLI Git.I just tested, and the following worked:
Or, more appropriately: