A remote git repository is just cloned to a local box using Atlassian SourceTree. Even no files have really been modified in the work tree, Atlassian lists a bunch of files right away under "Uncommitted changes". Each file shows same line count both as removed and added, and this count equals to the total count of lines in the file. This would somehow give a hint that we're hitting some kind of line ending problem.
However, the repository's .gitattribute
contains
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
that per GitHub article Dealing with Line Endings should make explicitly core.autocrlf
true for the repository. However also ~/.gitconfig
contains autocrlf = true
.
If the modified files are tried to be "reverted" back to previous commit, there is no effect. Same files are still seen as uncommitted.
The repository has been cloned into multiple locations and ensured that no files have been in the same path, to make sure that SourceTree or git do not remember old files.
The repository is collaborated with Windows, Linux and OSX boxes. This problem appears only in OSX.
What could still be wrong in the SourceTree/repository/git setup?
Update #1, 20. Apr 2013
As there is still something wrong, here are partial outputs of git config --list
.
From SourceTree console (OSX)
core.excludesfile=/Users/User/.gitignore_global
core.autocrlf=input
difftool.sourcetree.cmd=opendiff "$LOCAL" "$REMOTE"
difftool.sourcetree.path=
mergetool.sourcetree.cmd=/Applications/SourceTree.app/Contents/Resources/opendiff-w.sh "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED"
mergetool.sourcetree.trustexitcode=true
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.autocrlf=true
Here is corresponding output from Windows side:
core.symlinks=false
core.autocrlf=false
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
http.proxy=
core.autocrlf=true
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
core.eol=native
core.autocrlf=true
And full .gitattributes
for the repository in question
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
*.php text
*.twig text
*.js text
*.html text diff=html
*.css text
*.xml text
*.txt text
*.sh text eol=lf
console text
*.png binary
*.jpg binary
*.gif binary
*.ico binary
*.xslx binary
autocrlf
, you say it's set in ~/.gitconfig, but if it's set in your repository's .gitconfig then it'll override the global config. Have you tried settingautocrlf
in your repository .gitconfig to true? – Blakeneyautocrlf
- and they differ completely from each other even in same box. So, I think we have to try setting all possibleautocrlf
's totrue
. But - I think that.gitattribute
should also do something here, shouldn't it? There we have* text=auto
in the first row... – Broncotext=auto
would do as is stated in the git docs based on my answer below. It should auto-convert your line endings. If, for example, you removed that option and checked out your repository again then you shouldn't have a load of files listed as modified. – Blakeneyautocrlf
vars should be set to true. The best place to set it is in your local repo instance. Iftext
is set toauto
then as noted in the docs on checkin it'll normalize the line endings automatically. My below answer does cover these two situations so I think it's relevant, however it might not be addressing your problem exactly. Let me edit it a bit. – Blakeney