1

In my environment, I cannot log in to the Windows GUI, but I have to use sshd to get a console (cmd.exe) from windows server 2019. Git is installed, but as soon as I try to do a git push, I face a problem:

Usually, in a CMD Console in Windows, a window with the credential manager would pop up, which doesn't work for this use case, where I actually "ssh-ed" via putty to a windows server. It seems that git gets stuck, obviously wanting to open a window.

How can I turn off this behavior, and make git on Windows more "unix-ish", so that like in a Linux environment the username/password prompt appears on the console?

Mandragor
  • 4,684
  • 7
  • 25
  • 40

1 Answers1

1

Try and disable the credential helper (in your SSH session)

git config credential.helper=

That will allow you to test if Git is asking for credentials on the command line instead of opening a popup.
Note that this is only if you are cloning HTTPS URL.

Alternative option:

cd path/to/repo
git config --system --unset credential.helper
git config --global --unset credential.helper
git config --unset credential.helper
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • throws an error: git config credential.helper= git config credential.helper="" error: invalid key: credential.helper= – Mandragor Jan 04 '20 at 15:34
  • @Mandragor What version of Git do you have on that server you ssh'ed into? – VonC Jan 04 '20 at 15:37
  • git --version git version 2.24.1.windows.2 – Mandragor Jan 04 '20 at 15:44
  • @Mandragor OK. Then simply remove that setting (I have edited the answer), for testing. – VonC Jan 04 '20 at 15:44
  • your alternative option "git config --system --unset credential.helper" at least made it work on the console, but i am now confused, as it doesn't get stuck anymore, but also doesn't ask for my credentials and it simply works... – Mandragor Jan 04 '20 at 15:47
  • @Mandragor Is your remote repo a public one? If yes, there is no credentials required on cloning/pulling. On pushing, credentials are required only on HTTPS URLS, not SSH ones. – VonC Jan 04 '20 at 15:49
  • @Mandragor Is your remote repo URL an HTTPS one or an SSH one? – VonC Jan 04 '20 at 15:51
  • @Mandragor And it does not require any credential on git push? – VonC Jan 04 '20 at 15:54
  • no. as i cannot reboot the server right now, i suspect that the credential manager still somehow in the background provides the username / password, as i did not persist it on this server manually – Mandragor Jan 04 '20 at 16:01
  • @Mandragor a `git config --list --show-origin` should show you if there are any credential.helper still set. – VonC Jan 04 '20 at 16:02
  • yes you are right. still found an entry in the .gitconfig in my home directory. removed it and yes, finally the username / password request appears on the console! – Mandragor Jan 04 '20 at 16:07