The default Git installation in Windows works really bad if you’re using cmd.exe and have non-ASCII letters in your commit information and/or code.
Thankfully, Git is highly configurable, and the fix is rather easy:
- Set
i18n.commitencodingto the codepage you’re on incmd.exe(I’m onwindows-1252) - Set
i18n.logoutputencodingto the same codepage. - Set the
LESSCHARSETenvironment variable to a proper name for the code page you’re on (I’m onlatin1), either by:- Adding a user environment variable in
Control Panel > System and Security > System > Advanced System Settings > Advanced > Environment Variables..., or… - Setting it your
cmd.exesession (e.g.set LESSCHARSET=latin1)
- Adding a user environment variable in
Boilerplate version for your copy-paste convenience (replace encodings as necessary):
git config --global i18n.commitencodig windows-1252
git config --global i18n.logoutputencoding windows-1252
set LESSCHARSET=latin1
The first setting tells Git how your commit messages, including your author information, are encoded. The second tells Git what encoding it should use when writing output from a command like git log. The third and final setting tells less, the pager that Git runs git log output through, what encoding to use.