Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop git from adding carriage returns when cloneing a repo onto windows?

Tags:

git

git-config

I still have XP on my laptop and have installed Git so that I can do some work on it. When I clone a repository from my server (which is linux) it automatically adds carriage returns onto each line. So now Git thinks that every file has been modified when, in fact, they haven't.

I've tried adding the following lines to my .gitconfig file to no avail

[core]
    autocrlf = true

or

[core]
    autocrlf = input

I have also tried running

git config core.autocrlf <value>

within the repository in question, and then reset hard to head. This also didn't seem to work. Any help would be appreciated.

like image 502
Rhinosaurus Avatar asked Jun 19 '09 20:06

Rhinosaurus


People also ask

How should git treat line endings Windows?

text eol=crlf Git will always convert line endings to CRLF on checkout. You should use this for files that must keep CRLF endings, even on OSX or Linux. text eol=lf Git will always convert line endings to LF on checkout. You should use this for files that must keep LF endings, even on Windows.

Does git change line endings?

autocrlf is set to false on a fresh install of Git, meaning Git won't perform any line ending normalization. Instead, Git will defer to the core. eol setting to decide what line endings should be used; core. eol defaults to native , which means it depends on the OS you're using.

What happens if I clone a repository twice?

it really doesn't matter, each cloned copy of a repo is the same as any other (assuming there were no new commits between clone operations).


1 Answers

Why not "autocrlf = false?".

like image 171
João Marcus Avatar answered Nov 12 '22 21:11

João Marcus