Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Git sees executable files in WSL 2 linux file system as non-executable #4336

Closed
JeromeDane opened this issue Jul 25, 2019 · 2 comments

Comments

@JeromeDane
Copy link

Description

In WSL 2, when a Git repository is hosted within the Linux file system and contains executable files, these files are seen by Windows Git as non-executable.

Steps to reproduce

  1. In bash run the following commands:
cd ~
mkdir wsl2-executable-files
cd wsl2-executable-files
git init
touch test-executable
chmod 755 test-executable
git add .
git commit -m "Create executable file"
  1. Get the Windows path to this folder. This can be done by typing explorer.exe . in bash and getting the full path from the Windows Explorer window that opens. e.g: \\wsl$\Ubuntu\home\<user>\wsl2-executable-files

  2. In Windows PowerShell run the following commands:

cd \\wsl$\Ubuntu\home\<user>\wsl2-executable-files
git status

Expected Result

The Windows version of Git should not detect any changes to the repository hosted in the Linux file system

PS Microsoft.PowerShell.Core\FileSystem::\\wsl$\Ubuntu\home\<user>\wsl2-executable-files> git status
On branch master
nothing to commit, working tree clean

Actual Result (problem)

The Windows version of Git shows that test-executable has been modified:

PS Microsoft.PowerShell.Core\FileSystem::\\wsl$\Ubuntu\home\<user>\wsl2-executable-files> git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   test-executable

PS Microsoft.PowerShell.Core\FileSystem::\\wsl$\Ubuntu\home\<user>\wsl2-executable-files> git diff
diff --git a/test-executable b/test-executable
old mode 100755
new mode 100644

This also manifests in editors like Atom that have built-in support for Git. If a Windows version of Atom is opened to read the repository hosted in the Linux file system, it will also detect a change:

image

System Information

Windows Build Number

Microsoft Windows [Version 10.0.18941.1001]`

WSL Instance Information

C:\> wsl --list --verbose
  NAME      STATE           VERSION
* Ubuntu    Running         2

Ubuntu information

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic

Linux Git Version

$ git --version
git version 2.17.1

Windows Git Version

PS C:\> git --version
git version 2.22.0.windows.1
@therealkenc
Copy link
Collaborator

This is by-design Windows git.exe which does not grok Linux metadata. You'd see the same behavior if you did the same thing on a Real Linux box and Windows given identical circumstances. There are standard work-arounds for the impedance mismatch. Hail Mary ref #3865 maybe one day in a galaxy far far way.

@iugo
Copy link

iugo commented Aug 2, 2021

You can try git config core.filemode false then restart the Git GUI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants