I'm on windows and use:

Git will automatically manage line endings for you if you set the core.autocrlf option.
On Windows, you usually want to use true for this setting.

git config --global core.autocrlf true

https://help.github.com/articles/dealing-with-line-endings