1

I can use git to clone and push from my MobaXterm terminal application, but not from Windows PowerShell or RStudio terminal.

When I try to push from these terminals, git doesn't seem to know my username and tries to log me in as user "git." Or, at least, that's how I interpret this

enter image description here

I can't push or remote show origin. My password doesn't work at that prompt, and it doesn't seem to know my username.

One thing I tried is to launch git-gui. When I launch git-gui from MobaXterm, and choose "Show SSH Key", I can see a key there. When I launch git-gui from RStudio or PowerShell, I don't.

What's going on here? Are there two git-guis installed? How can I get everything configured correctly? Many thanks!

David
  • 5,882
  • 3
  • 33
  • 44
Arthur
  • 1,248
  • 8
  • 14
  • 1
    On windows git creadentials are stored inside [Credential Manager](https://support.microsoft.com/en-us/topic/1b5c916a-6a16-889f-8581-fc16e8165ac0) you can check if your credentials stored there or not if it's not then you've to [add](https://stackoverflow.com/a/46882242/14457833) one – Ankit Tiwari Jun 09 '22 at 17:06
  • 1
    Hard to tell what the URL is, but if it's an ssh URL, you must log in as `git@gitlab.com`; you'd normally use as your *public key* (not password!) the public key you registered with GitLab, and you wouldn't type that in at all. At most you'd type a pass*phrase* to unlock access to the public/private key-pair, so that your ssh can send the public key and use the private key. – torek Jun 09 '22 at 17:38
  • @Ankit, I have my credentials stored in Credential Manager, and it appears to work fine with Moba Xterm. Why would the credentials work fine for one terminal and not another? Is there some element of this process that is specific to the terminal? – Arthur Jun 10 '22 at 11:59

1 Answers1

0

When I try to push from these terminals, git doesn't seem to know my username and tries to log me in as user "git.

Assuming the URL used is indeed an SSH one (git@github.com:me/myRepo), please note the remote user is always git for SSH URLs.

The authentication is done through the private key matching the public one registered to the GitHub user account.

I have my credentials stored in Credential Manager, and it appears to work fine with Moba Xterm.

A credential managers only stores credentials (GitHub user account/password) for HTTPS URL, not SSH ones.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250