Handling line endings on Windows with git

< 1 min. read

Note to self: When collaborating on different platforms, one of the most common issue is line endings – LF on Mac/Linux and CRLF on Windows. With git, you can address this issue in the following ways:

1) Configure Global Settings

1) Windows users: git config --global core.autocrlf true
2) Mac/Linux users: git config --global core.autocrlf input

2) Configure Per-repository settings

echo "* text=auto" > .gitattributes
git add .
git commit -m "Files play nice in Mac, Linux and Windows"
git push origin master

Additional reading:
StackOverflow thread
Github help