Can git be configured to not perform autocrlf on certain files?
Asked Answered
J

1

7

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?

Jenks answered 29/1, 2015 at 20:46 Comment(0)
J
6

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/

Jenks answered 29/1, 2015 at 21:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.