Windows - CRLF - carriage retur + linefeed - \r\n Linux - LF - linefeed - \n MAC - CR - carriage return - \r
core.autocrlf
configuration setting:
true
- this converts LF endings into CRLF when you check out code, converts CRLF line endings into LF when you add a file to the index; usually used on windows machinesinput
- this converts CRLF to LF on commit only; used on Linux machines; if a file with CRLF endings accidentally gets introduced, it gets fixed on commitfalse
- no line conversions take place
The idea of this setting is to ensure that file hashes stay the same regardless of their line endings.
For more information see:
.gitattributes
defines attributes per path.
In case of line endings, this file can manage how Git reads line endings in a specific repository with text
and eol
attributes.
An example from Git documentation:
that will make Git normalize .txt, .vcproj and .sh files, ensure that .vcproj files have CRLF and .sh files have LF in the working directory, and prevent .jpg files from being normalized regardless of their content.
* text=auto
*.txt text
*.vcproj text eol=crlf
*.sh text eol=lf
*.jpg -text
Get URL of the remote: git config --get remote.origin.url
List the remotes: git remote -v
Switch the remote of the repo: git remote set-url origin https://github.com/USERNAME/REPOSITORY.git