So I've tried to introduce a .gitattributes
file to my projects repos but I've run into an issue where the file is not respected among some of my peers Windows 10 machines. I've tried looking at Git pull on Windows (git smc client) doesn't respect .gitattributes's eol=lf and many other posts to no avail as it doesn't fit the experience I am seeing. I would expect given this .gitattributes
file that all text would stay as LF but it is not. The windows OS is actively converting the files at git add
(which have all undergone git add --renormalize .
) to CRLF. The exact warning is: warning: LF will be replaced by CRLF in Callflows/ors_PostCreateOrsIssue.callflow. The file will have its original line endings in your working directory.
To confound it more, a couple of my peers' windows OS performs as expected where the LF and the .gitattributes
is respected.
Gitattributes:
# Setting a default value and trusting git to do correctly determine files
* text eol=LF
# Java sources
*.java text diff=java
*.gradle text diff=java
*.gradle.kts text diff=java
# These files are text and should be normalized (Convert crlf => lf)
*.css text diff=css
*.df text
*.htm text diff=html
*.html text diff=html
*.js text
*.jsp text
*.jspf text
*.jspx text
*.properties text
*.tld text
*.tag text
*.tagx text
*.xml text
*.grxml text
*.callflow text
*.json text
# These files are binary and should be left untouched
# (binary is a macro for -text -diff)
*.class binary
*.dll binary
*.ear binary
*.jar binary
*.so binary
*.war binary
*.jks binary
*.wav binary
*.vox binary
*.gram binary
Here is a working setup from my peers machine.
git --version
: 2.18.0.windows.1- global git config retrieved using
git config -l
.
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/asdf/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
user.name=asdf
[email protected]
difftool.sourcetree.cmd='' "$LOCAL" "$REMOTE"
mergetool.sourcetree.cmd=''
mergetool.sourcetree.trustexitcode=true
Setup from a peer where it is NOT working:
git --version
: 2.18.0.windows.1git config -l
:
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
Any help would be greatly appreciated!!
You've misconfigured your
.gitattributes
file. The attribute iseol=lf
, noteol=LF
. This option is case sensitive, like most Git options, and by specifyingLF
this attribute is left unset. Since it's unset and your version of Git is configured withcore.autocrlf=true
, your files are checked out as CRLF.If you fix that, things should work correctly.