How to force end-of-lines to LF on checkout using git?

Inside the .gitattributes file:

*.txt text=auto eol=lf