[colug-432] Configure Git Line Endings for Mixed Windows/WSL Environment

jep200404 at columbus.rr.com jep200404 at columbus.rr.com
Sun Sep 19 17:15:40 EDT 2021


What line endings should git be configured for 
when both Windows and Windows Subsystem for Linux (wsl)
are accessing the same text files of a git repo
and git commands are executed in
both Windows and Windows Subsystem for Linux (wsl)?

Why?

When only linux or wsl is accessing files of a git repo,
one uses only LF line endings for text files,
and specifies autocrlf = input in ~/.gitconfig.

When only Windows is accessing files of a git repo,
one uses only CRLF line endings for text files,
and specifies autocrlf = true in .gitconfig (wherever that is).

But it's not so clear what the right thing to do is in the mixed
environment.

For the mixed environment, I currently configure git to use the 
line endings of the predominant editor.

I.e., if a Windows editor
(which likes CRLF line endings) is mainly used, then specify
autocrlf = true in both the Windows and wsl git configurations.
If the editing is done mainly is wsl (which likes LF line endings),
then specify autocrlf = input in both the Windows and wsl git configurations.

So far that seems to be working, but I don't know what I am
missing. What am I missing?


More information about the colug-432 mailing list