Search code examples
gitcygwinatlassian-sourcetree

Sourcetree showing files as modified right after checkout?


I checked out a Git repo in Cygwin on Windows. Than I installed Sourcetree and opened the same (local) repository. I was surprised to see that Sourcetree marked many files as modified.

I've opened files in Notepad++ (before I opened the repo in Sourcetree) and saw the line endings are LF.

When I execute git config --list I get core.autocrlf=false.

When I clone the repository from within Sourcetree, all is OK (neither Cygwin nor Sourcetree show any modified files).

I also checked the file permissions, but they seem to be the same, so Cygwin seems not to change the permissions.

What could be the reason for such behavior? Cygwin seems to be doing something that Sourcetree considers a file change?

Cygwin git version: 2.21.0
Sourcetree git version: 2.24.1


Solution

  • This resolved the issue:

    git config core.filemode false
    git config core.autocrlf true
    

    (Executed from the Cygwin command line.)

    Strangely enough, the same commands with --global switch did not help, meaning those two commands need to be executed every time a new repository is cloned.