Git Line-Endings

Hi experts,

we are evaluating Git at the Moment and I have questions about line endings:

Our developers are working an Windows Systems, with Git and SourceTree.
The line ending Setting ist set to core.autocrlf=true . That means that text files will be converted to CRLF when downloaded to the working directory and cenverted back to LF when uploaded to Git Repository.


I have a bare repository on a Windows Share. I cloned that repo.

I took a file called "Environment" (LF) and a file "test.html" (LF) and commited those files und pushed it to  the repo.
Afterwards I deleted the local working Directory and did a fresh clone of the repo.

Now the files have LF line endings, alltghough core.autocrlf=true  should convert them to CRLF?

Am I  testing wrong?

How do you manage line endings? When developers write code for Java applications (in Tomat), which will run on Linux machines...
How would you manage the Settings in Git?
On use case could for example be, that a file of the application from a developer`s working direkctory should be copied to a Linux Server running Tomcat. Would this make any Problems?

Thanks in advance!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

evilrixSenior Software Engineer (Avast)Commented:
When you clone a repo it doesn't clone the git config settings. Did you set your global git settings to use autocrlf? If not it'll use whatever setting is the default for your version of Git on your platform.

There are also other settings that play a part in the management of line endings:

I always have mine convert to LF on commit and checkout to whatever the local format is. I use gitattributes to handle special cases.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Franck HorlavilleTechnical DirectorCommented:
Most IDEs and text editors can work fine with LF line endings - if you're hosting on linux can I suggest you use LF in all your workflow ?

Otherwise I second the answer by evilrix

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Version Control

From novice to tech pro — start learning today.