2

Whenever i push through git all my bash scripts seem to be corrupted with the \r character. It doesn't affect the code, but it just adds a significant amount of noise to my work. Looked all over the web, but can't seem to find a solution.

Example:

    echo "*************************************************************************"\r

                                                                                     ^

Every line in my bash scripts are always ended with this special character. I use STS on Windows 7. Any ideas?

Jim Garrison
  • 85,615
  • 20
  • 155
  • 190
user1816481
  • 107
  • 1
  • 8
  • You can try switching from Windows new line endings to Unix style in Eclipse. Here's how to do that: http://stackoverflow.com/questions/1886185/eclipse-and-windows-newlines – austin Aug 15 '13 at 15:14
  • Just tried that and no joy. – user1816481 Aug 15 '13 at 15:16
  • When do they get added? When you commit? – kelorek Aug 15 '13 at 15:19
  • 3
    Do you have something in your `.gitattributes` file that would cause line endings to be changed? Here's a doc on that: https://help.github.com/articles/dealing-with-line-endings – austin Aug 15 '13 at 15:23
  • there is a unix tool called dos2unix that alters \r, though, I'd check to see which alphabet git is configured to use, maybe it is using cp1251 and you could change the properties to something more compatible... – Dru Aug 15 '13 at 20:59
  • Thanks 'austin'. That seemed to solve the problem. If you put your solution as an answer, i will then mark it as the correct answer, so for other people who might have the same issue. Thanks to others for your efforts :) – user1816481 Aug 16 '13 at 08:02

1 Answers1

1

Put this two lines into your .gitconfig file in the root of your repo or into your home if you need to make this settings global :

[core]
   eol = lf

You can find more about this here : https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

kisp
  • 6,402
  • 3
  • 21
  • 19