问题
I am using git on a Java project which is deployed to Windows, Linux, and Mac clients. For this Java project, I also maintain *.sh scripts for running the compiled binaries on Mac/Linux and .exe/.bat files for running the compiled binaries on Windows. My development environment is Windows.
Git's autocrlf feature is converting line terminators in my *.sh scripts to the Windows format, which renders them useless on Linux/Mac after deployment. I want to save them in the Unix format and have git leave the line terminators alone. Can git be configured to ignore autocrlf for these specific files (there are three in a single folder)? If so, how?
回答1:
Looks like this is configurable if you add a .gitattributes
file to the base-level folder in your repository, then explicitly call out which file types are binary, which are text, and of the text types, which should be CRLF, LF, or auto configured.
https://help.github.com/articles/dealing-with-line-endings/
来源:https://stackoverflow.com/questions/28224273/can-git-be-configured-to-not-perform-autocrlf-on-certain-files