BaltoStar
BaltoStar

Reputation: 8987

Configure git repository so that all files are stored with line-ending LF (not CRLF)?

For a specific github repo ( only ) I need to make sure that all text files pushed have LF line-ending ( not CRLF ).

Further, pulled-down repo files should retain LF line-ending on clients either OSX or Windows.

Is this possible ?

Upvotes: 2

Views: 424

Answers (2)

Włodzimierz Gajda
Włodzimierz Gajda

Reputation: 1592

Try to add a file named .gitattributes with the following contents:

*  eol=lf

to your repo. Then no matter what settings for core.autocrlf developers use, all the files will always use LF.

Just keep in mind, that it will change CRLF into LF upon commit in binary files also (like zip, jar, png, etc.).

Upvotes: 1

nneonneo
nneonneo

Reputation: 179442

You can't really control what your clients do - if they have core.autocrlf set to true then LF will get translated to CRLF automatically.

If everyone uses core.autocrlf = input then it should all work fine.

Upvotes: 0

Related Questions