Reputation: 179
I have generated a public and a private key using PuTTYgen and added the public key to my GitLab account, but when I try to clone the repository, it still wants a password.
I have read the following instructions from this site
Install Putty and related utilities
Set system environment variable in Windows(Control Panel\System and Security\System --> and clicking on "Advanced system settings" in the left pane. Then click on "Environment Variables") GIT_SSH=%path_to_plink.exe% (Note plink.exe goes into wherever you installed Putty)
Generate a ssh key using puttygen.exe (ssh2-rsa, 4096, comment=GitLab, and set a passphrase)
Add key to pageant.exe and the public key to your GitLab profile
Ensure you start a new command shell so that git recognizes the GIT_SSH value
Try these two commands to check connection first. This should give you a popup window that authenticates connection
set Git putty [email protected]:%user%/%repo.git%
Usage:
I still don't understand step 5 and in step 6 I see no shell commands to do the test.
Can anyone help?
Update:
The issue was that I didn't restart my cmd. But now I get this message: The server's host key is not cached in the registry. You have no guarantee that the server is the computer you think it is. The server's ssh-ed25519 key fingerprint is: ssh-ed25519 255 d7:0d:ca:f2:c1:01:46:80:68:4c:5d:e6:d4:52:f9:16 If you trust this host, enter "y" to add the key to PuTTY's cache and carry on connecting. If you want to carry on connecting just once, without adding the key to the cache, enter "n". If you do not trust this host, press Return to abandon the connection. Store key in cache? (y/n)
And it doesn't let me type anything there.
Upvotes: 1
Views: 10326
Reputation: 1327164
Ensure you start a new command shell so that git recognizes the GIT_SSH value
Type git bash
, then "set|grep GIT_SSH
"
If the result is empty, the CMD session in which you opened your session did not inherit your Windows User environment variable. Open a new CMD.
But I would not recommend using Putty. Git for Windows comes with openssh, and that should be enough, in a git bash session
ssh-keygen -t rsa
<enter a passphrase>
See more at GitHub (that will apply for GitLab as well) "Generating a new SSH key and adding it to the ssh-agent"
The OP Petar Yakov reports having to register the password of their GitLab account in the Credential Manager.
Then the SSH access works.
Upvotes: 2