Skip to content

git-bash "basic credential prompt" will encode passwords in non-UTF8 #2215

@celalsahin

Description

@celalsahin

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?

$ git --version --build-options
git version 2.20.1.windows.1
cpu: x86_64
built from commit: 7c9fbc0
sizeof-long: 4
sizeof-size_t: 8

  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
    Win 10 64-bit
    C:\Users\tr1s4323>ver

Microsoft Windows [Version 10.0.15063]

  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
C:\Users\tr1s4323>type "C:\Program Files\Git\etc\install-options.txt"
Editor Option: VIM
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled

 ### Details

 - Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Bash


$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=

 - What commands did you run to trigger this issue? If you can provide a
   [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve)
   this will help us understand the issue.

Short: If I don't use "windows credential helper" (i.e. credential.helper manager) for the password, 
special characters (e.g. § - õ) does not work in password. 

Long: "OpenSSH" prompt(pop-up) asking for the password does not encode the password in UTF8 
although all is set to use UTF8 in shell. I just recognized this via "gitlab" installation. This can be 
reproduced, e.g.: (just enter "§" for the username & password in basic cred. prompt.)

$ git clone https://gitlab.com/celal.sahin/celal_test_123.git
Cloning into 'celal_test_123'...
Logon failed, use ctrl+c to cancel basic credential prompt.
Username for 'https://gitlab.com': §
fatal: unable to access 'https://gitlab.com/celal.sahin/celal_test_123.git/': The requested URL returned error: 500
--

--> I had credentials manager set so I canceled it to get the "basic credential prompt", which is 
"OpenSSH" window in my case. This will trigger the error in gitlab logs as:

ActiveRecord::StatementInvalid (PG::CharacterNotInRepertoire: ERROR:  invalid byte sequence for 
encoding "UTF8": 0xa7

Using "Windows Credential Manager" passwords with "§" "õ" etc. would succeed. 

 - What did you expect to occur after running these commands?

I expect both "basic cred prompt" & "Windows Cred. Manager" act the same way & follow the encoding
 settings of the terminal/system.

 - What actually happened instead?

"Basic Cred Prompt" does not follow the system encoding settings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help Wantedhelp is requested from collaborators, please!buggit

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions