7

I am a bit confused with core.eol, core.autocrlf, core.safecrlf for git config.

http://git-scm.com/docs/git-config

I am using Ubuntu and Widows.

I had ^M, and other issues before.

Could anyone suggest the best git config setups for this problem?

Thanks in advance.

shin
  • 31,901
  • 69
  • 184
  • 271

1 Answers1

23

As detailled in Git on Windows (msysgit) - Unix or DOS line termination, I would use:

git config --system core.autocrlf false

That would avoid any automatic eol transformation (See "Git on Windows: What do the crlf settings mean?" for the exact meaning of this option value).

You can leave it to true, as explained in git replacing LF with CRLF, but I prefer setting core.eol + some gitattribute files in order to fine tune some of the files I want eol changes on.
See this answer for more details.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • +1 - I know there's a variety of advice about this, but I would also always go for `core.autocrlf` set to `false`, and make sure you only use tools that are good enough to deal with different line endings (a point VonC makes in the first linked answer) – Mark Longair May 21 '11 at 13:39
  • But this setting give a ^M when you git diff, doesn't it? – shin May 23 '11 at 07:14
  • @shin: for files written on Windows and a diff done on Windows, I never saw `^M` during a diff. – VonC May 23 '11 at 07:41