3

When git asks me for credentials, a dialog box appears. However, this doesn't work in PowerShell remote sessions. I have to open an RDP session on the computer.

How can I make git ask for credentials from the command-line?

Note: I don't want to store a clear password in some file nor type a clear password in the command-line.

Luke
  • 1,734
  • 2
  • 15
  • 18

2 Answers2

2

Install the Git Credential Manager for Windows
This can also be done with Chocolatey:

choco install git-credential-manager-for-windows

Then configure the manager to ask the password from the command-line:

git config --<system|global|local> credential.modalPrompt false

However, according to this issue, it does not work remotely from the command line.

Luke
  • 1,734
  • 2
  • 15
  • 18
  • I could be mistaken, but I still think that a complete uninstall of the win-manager is needed to restore the command line prompt. – Antares Apr 28 '20 at 10:37
  • The "credential-manager-for-windows", sorry for the shortening. As I read, there is an option at the installation of git, where you can deselect it to be not installed. But there are ways to uninstall it afterwards described in the mentioned article https://stackoverflow.com/questions/37182847/how-do-i-disable-git-credential-manager-for-windows (This is the Link to the original post on StackOverflow) – Antares Apr 28 '20 at 20:13
1

I think you are mistaken that git itself asks you for your credentials in a separate GUI window. git is a command line only program. However, there is the credentials subsystem which in turn may call/calls some external program to do its job.

You need to check your git configuration file to find out which program is invoked and change that setting. See the git doku on Credentials Storage for reference. Don't be fooled that this help is about the storing of passwords. The thing you need to look for is disabling the credentials helper (restoring the default behavior with no credentials helper) to get what you want.

Here is how to remove the helper:

git config --<system|global|local> --unset credential.helper

More about how to uninstall the credentials helper for windows.

Antares
  • 605
  • 3
  • 14
  • thanks for helping me to understand the way it works. Your solution is ok inside a local session but unfortunately doesn't work in a PowerShell remote session. – Luke Apr 28 '20 at 10:13
  • With your answer and another comment I've improved my git knowledge, but I have still to RDP to enter credential at least once... – Luke Apr 28 '20 at 10:32