How do I get git to stop changing newlines in my files?

I’m using git/github with Eclipse/EGit on Windows. Something — not sure if it’s git or EGit — is modifying my files by playing games with newlines.

Leaving aside the mystery of what a version control is doing modifying files by itself, how do I configure this software so it never, ever, changes my files?

  • Eclipse + Git - How to get toolbar?
  • Am I using Git in Eclipse the right way?
  • How do you merge in GIT on Windows?
  • Unknown icon when using Subclipse 1.6.5
  • What does the error “EGit could not detect where Git is installed” mean?
  • Maven m2e-egit install failure under Kepler
  • Gerrit Code Review error - you are not committer
  • How to ignore one file in gitignore while unignoring its parent folder
  • codeGoogleCom exported Wiki, how to merge it?
  • Git branching to keep sub-projects up-to-date
  • TortoiseGit filter for 2 user names
  • Combine few commits. Git rebase
  • 2 Solutions collect form web for “How do I get git to stop changing newlines in my files?”

    You have many options depending on your OS:

    http://help.github.com/line-endings/

    The reason for the seemingly bizarre behavior is explained there. Basically the code is being shared (git and github) but the OS may be different. As different OS’s treat linefeeds differently, something has to change…

    git config --system core.autocrlf false
    git config --system core.whitespace cr-at-eol
    

    Don’t allow it to change anything or report problematic CR bytes at the end.

    Git Baby is a git and github fan, let's start git clone.