김민재
김민재

Reputation: 111

How to fix Git warning: LF will be replaced by CRLF

I need help with an error when pushing to github

  1. What is causing the Git warning: LF will be replaced by CRLF error?

  2. How to fix Git warning: LF will be replaced by CRLF

     cd "C:\Users\JMLEE\Desktop\파이썬\hw6"
     Git init
     git remote add origin https://github.com/rlaalswo1222/hw6.git
     git add .
     git status
     git commit -m "hw"
     git push origin master
    

Upvotes: 10

Views: 57024

Answers (2)

Narthana Jananjaya
Narthana Jananjaya

Reputation: 77

This command will help to fix that warning

     git config --global core.autocrlf true

Upvotes: 6

Alexander Santos
Alexander Santos

Reputation: 1691

It's not an error. It's telling you an action it will do to keep the standards

What is causing the Git warning: LF will be replaced by CRLF error?

It's the "end of the line" representation. This can be editted in most of editors (i.e. VSCode).

VSCode CRLF

What it says is that when ending a line, this ending representation will be a CRLF character. CRLF means Carriage Return and Line Feed. For more info on this, check this answer.

How to fix Git warning: LF will be replaced by CRLF

To "fix" this, you just need to set a standard. If you want CRLF as standard (the "Windows default"), you just need to make your editors use CRLF. And vice-versa. It's not a problem though, it just converts the EOL's to the standard. You can also disable this option. There's a good answer to how to setup git for those configurations

On VSCode, taking as example, there's a good extension to see those end-of-lines https://marketplace.visualstudio.com/items?itemName=medo64.render-crlf Most edittors can also show those characters somehow, but it isn't enabled by default.

Upvotes: 14

Related Questions