til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as an open source contributor and product manager

View project on GitHub

Configure Git

I have just started working with WSL under Windows 10. Coming from *nix (primarily macOS), the WSL is very appealing to me and the lack of a proper *nix toolchain, what drove me away back in the day. But now I am back and attempting to get everything to work smoothly.

WSL 1

The recommendation is to set core.autocrlf to false, based on the blog post by Pete O’Shea.

This has somewhat worked for me on WSL1

$ git config --global core.autocrlf false

You can checkout the value using:

$ git config --list --show-origin
...
file:/home/jonasbn/.gitconfig   core.autocrlf=false
...

WSL 2

For me it has always made sense to have core.autocrlf set to true, which contradicts the section above based on the blog post by Pete O’Shea.

$ git config --global core.autocrlf true

You can checkout the value using:

$ git config --list --show-origin
...
file:/home/jonasbn/.gitconfig   core.autocrlf=true
...

Resources and References

  1. First-Time Git Setup
  2. my .gitconfig from my dotfiles repository
  3. Blog post by Pete O’Shea: Setup Git in WSL
  4. GitHub Community
  5. GitHub: help