Setting the Line Ending Conversion
Background
Different operating systems may use different line endings. Therefore, if you open a file created in an operating system different from yours, the file may be displayed incorrectly. This problem may also occur when you use version control systems.
Procedure
- (Optional) By default, core.autocrlf is set to false in Git. Perform the following operations to enable Git to identify and convert the line endings for text files:
- On Windows
Set core.autocrlf to true. All text files in the local repository use LF line endings whereas those checked out to the working directory use CRLF line endings.
- On Linux
Set core.autocrlf to input. When files are imported to the local repository, Git auto-converts line endings from CRLF to LF. No conversion is performed when files are checked out from the local repository to the working directory.
- On Windows
- Set core.autocrlf to true to enable auto-conversion of line endings.
git config --global core.autocrlf true
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.