.gitattributes在大多数windows操作系统上不受尊重



因此,我曾试图将.gitattributes文件引入我的项目repos,但我遇到了一个问题,即该文件在我的一些同行Windows 10机器中不受尊重。我试过在Windows上查看Git pull(Git-smc客户端(;t尊重。gitattributes';s eol=lf和许多其他帖子都无济于事,因为它不符合我所看到的体验。我希望给定这个.gitattributes文件,所有文本都将保持为LF,但事实并非如此。windows操作系统正在主动地将git add处的文件(这些文件都经过了git add --renormalize .(转换为CRLF。确切的警告是:warning: LF will be replaced by CRLF in Callflows/ors_PostCreateOrsIssue.callflow. The file will have its original line endings in your working directory.

更令人困惑的是,我的几个同行的windows操作系统在LF和.gitattributes受到尊重的地方表现如预期。

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

这是我的对等机器上的工作设置。

  • git --version:2.18.0.windows.1
  • 使用git config -l检索全局git-config
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
user.email=asdf@asdf.com
difftool.sourcetree.cmd='' "$LOCAL" "$REMOTE"
mergetool.sourcetree.cmd=''
mergetool.sourcetree.trustexitcode=true

不工作的对等设置

  • git --version:2.18.0.windows.1
  • 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/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

任何帮助都将不胜感激!!

您的.gitattributes文件配置错误。属性是eol=lf,而不是eol=LF。与大多数Git选项一样,此选项区分大小写,并且通过指定LF,此属性不设置。由于它是未设置的,并且您的Git版本配置了core.autocrlf=true,因此您的文件将以CRLF的形式检出。

如果你解决了这个问题,事情应该会正常工作。

相关内容

  • 没有找到相关文章

最新更新