4

I have followed these instructions for generating keypairs using ssh-keygen. I actually generated both the ed25519 and an rsa key as I attempted to figure out what was wrong.

I copied and pasted the public key pair for both of these keys in gitlab according to their instructions.

when I enter: ssh -T git@gitlab.com it says:

client_global_hostkeys_private_confirm: server gave bad signature for RSA key 0

but it also says Welcome to gitlab, @my_username!

when I try to push to my repo, I get a popup asking for my gitlab username and password which I enter and which fails.

I don't understand why it is prompting me for a username and password considering that I have attempted to establish SSH keypairs for authentication.

Any advice is appreciated

unbutu
  • 125
  • 2
  • 9
  • 1
    Maybe you cloned via https, not ssh? – ti7 Mar 29 '21 at 21:30
  • I'm almost certain I used the SSH method – unbutu Mar 30 '21 at 00:28
  • 1
    Try `git remote -v`, which should show the remote url with at least an `@` in it – ti7 Mar 30 '21 at 00:37
  • Does this answer your question? [Pulling from Git fails and gives me following error: client\_global\_hostkeys\_private\_confirm: server gave bad signature for RSA key 0](https://stackoverflow.com/questions/67401049/pulling-from-git-fails-and-gives-me-following-error-client-global-hostkeys-priv) – Trevor Boyd Smith Aug 05 '21 at 13:58

1 Answers1

12

I get a popup asking for my gitlab username and password which I enter and which fails.

Check, as commented:

  • git remote -v
  • git config credential.helper

If the first starts with https://, and the second is not empty, what you see is a Git credential helper trying to cache your HTTPS credentials.
That means your SSH key would be ignored anyway.

Regarding the error message, check out this thread, and test it with:

ssh -o UpdateHostKeys=no -Tv git@gitlab.com

To make it persistent, in ~/.ssh/config:

Host gitlab.com
  UpdateHostKeys no
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I see the https:// prefix after running `git remote -v`. Testing with the `UpdateHostKeys=no ` command seemed to work. I am not sure how to correct the issue of it using https:// instead of ssh and it trying to "help" with the credential helper. I'd like to be able to use my ssh keys and just push to the repo. Thanks for the links. – unbutu Apr 01 '21 at 19:01
  • @unbutu If you see https:// and want to use your SSH keys, you need to switch to SSH with: `git remote set-url origin git@github.com:/.git` – VonC Apr 01 '21 at 19:07
  • Thanks. This helped a lot. – unbutu Apr 02 '21 at 22:36
  • @VonC maybe you should transcript the answer mentioned in your link to your answer here because links might break over time. In any case, it actually worked for me thanks. (I mean the part where he suggests adding "Host gitlab.com\nUpdateHostKeys no" to the `~/.ssh/config` file, which is a permanent solution: https://www.reddit.com/r/archlinux/comments/lyazre/openssh_update_causes_problems/gpuwe3x?utm_source=share&utm_medium=web2x&context=3 – VinGarcia May 17 '21 at 12:57
  • 1
    @VinGarcia Good point. I have edited the answer accordingly. Don't hesitate to add your own edit if I have missed something. – VonC May 17 '21 at 17:27
  • 1
    Thanks, what you wrote is perfect, I upvoted the answer =] – VinGarcia May 18 '21 at 23:21