Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git modifying line endings on binary files

I have git running in the default setup and would like to change the configuration so that neither the client or server instances of git make any changes to the line endings.

Currently, there is not a gitattributes file in the repo and the client shows the following output:

>> git config --get core.autocrlf
true

What is the recommended way to make sure that both the client and server respect the original line endings and do not make any modifications? Please note that the repo contains both binary and text files.

Any recommendations are welcome. Thanks.

like image 800
nuprap Avatar asked Aug 09 '26 18:08

nuprap


1 Answers

First, make sure to have git config --get core.autocrlf set to false: that will avoid Git itself to change eol.

Second, set a .gitattributes file with eol=lf directives for the files you want (that will exclude the binaries)

like image 116
VonC Avatar answered Aug 12 '26 12:08

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!