git log output encoding issues on Windows 10 command prompt
Problem
How to make git log command output properly displayed on windows command prompt?
Example
As you can see I can type diacritical characters properly but on git log the output is somehow escaped. According to UTF-8 encoding table the codes between angled brackets ( and > ) from the output correspond to the previously typed git config parameters.
I have tried to set LESSCHARSET environment variable to utf-8 as sugested in one of the answers for similar issue but then the output is garbled:
I know .git/config is encoded properly with utf-8 as it’s handled by gitk as expected.
Here is locale command output if necessary
The output is the same also in pure git-bash:
so I believe the problem is shell independent and relates to Git or its configuration itself.
6 Answers 6
Okay, I experimented a bit and found out that Windows Git commands actually need UNIX variables like LC_ALL in order to display Polish (or other UTF-8 characters) correctly. Just try this command:
Then enjoy the result. Here is what happened on my console (font «Consolas», no chcp necessary):
Update:
- Well, in order for Windows commands like type (display file on console) to work correctly, you do need chcp 65001 .
- And if you prefer commands from Git Bash like cat you profit from the aforementioned set LC_ALL=C.UTF-8 .
Update 2: How to make the changes permanent
As user mono blaine said, create an environment variable LC_ALL and assign it the value C.UTF-8 , either globally or for your own user profile only (sorry for the German screenshot):
Next time you open a command processor console (cmd.exe) you should see the variable value when issuing the command echo %LC_ALL% . In PowerShell you should see it when issuing $env:LC_ALL .
The simplest way to make the UTF-8 code page permanent ist to open regeedit and add a new value named Autorun of type string to section HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor and assign it the value chcp 65001 .
How do I sign out in the Git Bash console in Windows?
I’m using Git, on Windows, version 2.9.2.windows.1.
I work on a repository project and when I do a push, it asked me to enter my GitHub username and password. I entered both my GitHub username and password to update the project.
In my next push, it doesn’t ask for my username and password any more. All my modifications for the project are updated.
It looks like my username and password are «saved». How do I «unsave» them?
How do I sign out?
But they do not make me sign out.
I want to clear my sign in so the next time I make a push, it asks me again to enter my username and password.
9 Answers 9
First, user authentication has nothing to do with user.name and user.email git config.
Check your config ( git config -l ) and see if «manager» is registered there.
Update 2018: » delete » is now deprecated, use reject :
Update 2020: » reject » is now deprecated, use erase :
Actually, whatever ‘ xxx ‘ credential manager you are using (‘ xxx ‘ being the result of git config credential.helper ), you can do:
This is better than fiddling with the Credential Manager of your OS.
That git-credential-xxx executable is in usr/libexec/git-core or (for Windows) mingw64/libexec/git-core of your Git installation.
As mentioned here, on MacOS, it should already be in /usr/local/git/bin/ .
If git config credential-manager returns store, then Git uses the “store” mode, which saves the credentials to a plain-text file on disk, and they never expire.
I would remove that particular credential helper from the config, as it stores credentials in plain text.
The OP Lord Rixuel actually confirms in the comments it is a native Windows Credential Manager function which provides automatically (Git or not) the credentials:
I see the «Manage your credentials» option, I click on it out of curiosity, then I click on «Windows Credentials», under «Generic Credentials», there is » git:github.com «;, I click on it and there is the «Remove» option. I clicked Remove.
When I do a git push, it asks again for my user and my password. Exactly what I want when I want to sign out.