Skip to content

Windows Line Endings and Git

Stuart Mashaal edited this page Jul 10, 2017 · 2 revisions

Linux systems use the line-feed (LF) character as the End-Of-Line (EOL) character and Windows systems use the CRLF two-character sequence as EOL character (CR = the carriage-return character). We want our repo to only contain LF-style line endings.

On Windows, run

$ git config --global core.autocrlf true

This will make git autoconvert LF to CRLF on pulls, and autoconvert CRLF to LF on push. This way, Windows systems will not accidentally put CRLF line endings onto the remote repo, but will still have CRLF line endings when editing.

On Linux, run

$ git config --global core.autocrlf input

This will make git autoconvert CRLF to LF on pull. This way, any file containing CRLF in the remote repo will be fixed to LF when a Linux user edits it.

Clone this wiki locally