MSYS2-packages icon indicating copy to clipboard operation
MSYS2-packages copied to clipboard

git bash unable to create key. when i put passphrase and then they said failure.

Open asaduzzaman-shahin opened this issue 4 years ago • 7 comments

SHAHIN@DESKTOP-S3VBMK0 MINGW64 ~/Desktop/mygitkey (master) $ ssh-keygen -t rsa -b 4096 -C "[email protected]" Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/SHAHIN/.ssh/id_rsa): mykey Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in mykey Your public key has been saved in mykey.pub The key fingerprint is: SHA256:BMQGznnnkO43yn8Gm1SCQSfJPBYTpQ6IUhS5vIIshTs [email protected] The key's randomart image is: +---[RSA 4096]----+ | .+o.BO=o | | o.+ .XB | |oo..=o=+o | |o + =.=. . | |oo . o So | |E.. . o | |.o ..o+ | | . oo.o | | o..o | +----[SHA256]-----+

SHAHIN@DESKTOP-S3VBMK0 MINGW64 ~/Desktop/mygitkey (master) $ eval "$(ssh-agent -s)" Agent pid 653

SHAHIN@DESKTOP-S3VBMK0 MINGW64 ~/Desktop/mygitkey (master) $ ssh-add -K /Users/you/.ssh/id_rsa Enter PIN for authenticator: Provider "internal" returned failure -1 Unable to load resident keys: invalid format

asaduzzaman-shahin avatar Jan 25 '21 18:01 asaduzzaman-shahin

I'm facing the same issue and would appreciate any suggestions?

Rugiada avatar Jan 25 '22 14:01 Rugiada

From what I remember, all I needed to do was ssh-keygen ... and just use ssh, I don't think I ever had to use ssh-agent or ssh-add, but either way, I think the last command is incorrect as that looks like it came from a macOS tutorial, it should probably be ssh-add -K ~/.ssh/id_rsa

1480c1 avatar Jan 25 '22 14:01 1480c1

2 things:

  1. You should replace /Users/you/ by your actual user folder location. Probably you can just replace it by ~, which is the current's user folder location.
  2. Try with ssh-add -k ~/.ssh/id_rsa (small k instead of capital K)

reconlabs-sergio avatar Jun 27 '22 04:06 reconlabs-sergio

thanks @sergiobdrl ,for a moment I would say "hey wait man I looked the man page and the K is for .." and re read-it and yes, below that is the minus k solves the invalid format issue...

Regards,

coxsk8 avatar Aug 16 '22 22:08 coxsk8

SHAHIN@DESKTOP-S3VBMK0 MINGW64 ~/Desktop/mygitkey (master) $ ssh-keygen -t rsa -b 4096 -C "[email protected]" Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/SHAHIN/.ssh/id_rsa): mykey Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in mykey Your public key has been saved in mykey.pub The key fingerprint is: SHA256:BMQGznnnkO43yn8Gm1SCQSfJPBYTpQ6IUhS5vIIshTs [email protected] The key's randomart image is: +---[RSA 4096]----+ | .+o.BO=o | | o.+ .XB | |oo..=o=+o | |o + =.=. . | |oo . o So | |E.. . o | |.o ..o+ | | . oo.o | | o..o | +----[SHA256]-----+

SHAHIN@DESKTOP-S3VBMK0 MINGW64 ~/Desktop/mygitkey (master) $ eval "$(ssh-agent -s)" Agent pid 653

SHAHIN@DESKTOP-S3VBMK0 MINGW64 ~/Desktop/mygitkey (master) $ ssh-add -K /Users/you/.ssh/id_rsa Enter PIN for authenticator: Provider "internal" returned failure -1 Unable to load resident keys: invalid format

EmmanuelEyo avatar Mar 28 '23 16:03 EmmanuelEyo

and please the part where they said to enter the pin for the authenticator. what pin are they exactly referring to? is it my system pin?

EmmanuelEyo avatar Mar 28 '23 16:03 EmmanuelEyo

@EmmanuelEyo if you didn't enter any passphrase during the creation of the key then your PIN/Passphrase should be empty. Pressing "enter" on the keyboard should work just fine. One thing I notice is, if you use this code: ssh-add -K ~/.ssh/id_rsa or ssh-add -K ~/.ssh/id_ed25519 you get an error with PIN authenticator so rather change the "K" to a lowercase ie. ssh-add -k ~/.ssh/id_rsa or ssh-add -k ~/.ssh/id_ed25519 and press "enter" if passphrase is requested. That should solve it.

AugustineBarnes avatar Jan 05 '24 06:01 AugustineBarnes