Search code examples
gitbinaryfileseol

How to add to git binary file, which has both CRLF and LF symbols inside?


I try to add GIF image to repository, but git translates CRLF symbols to LF, so image is broken inside repository. I tried to set core.autocrlf = false and core.safecrlf = true, but all I've got now is fatal: CRLF would be replaced by LF in test.gif. What should I do to add any binary file, which could have any characters inside?


Solution

  • In my experience, git's implementation to handle EOL formats is a PAAAAAAIN. I would ask git not to do anything related to EOL format. That is done by adding * -text in .git/info/attributes. Not sure how that will affect binary files, though.