📜 ⬆️ ⬇️

Connecting to Git over SSH in Windows without PuttyGen using BitBucket as an example

Many articles (including on Habré) are devoted to connection to Git on SSH keys. Almost all of them use one of two ways: either using puttygen.exe, or using the ssh-keygen or ssh-add commands.

Yesterday, on one of the computers, I didn’t manage to do this for msysgit using any of the methods described on the Internet, and I spent several hours trying to configure SSH access without having achieved anything.

How I solved this problem - under the cut.

BitBucket always cursed that it needed to connect using the key:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the repository exists.

My attempts to generate keys, specify paths in environment variables, and bind keys to the gita were useless. Either git cursed with quackers (in the case of ssh-agent cmd.exe ), or simply ignored everything offered.
')
The decision was much more convenient and easier. Just run GIT GUI Here in the local repository, and in the menu go to
Help -> Show SSH Key :

Screenshots
image

image


If you encounter such a problem, then most likely you will have nothing there:

SSH Key generation window
image

Well, then most likely, only the most pedantic will read ... Click the Generate key , see the password request window (twice) for the private key:

Password request
image

And we see the generated public key:

Public key
image

We copy it and add the GIT web-face (in my case it is BitBucket; there you can add keys in two places - in the account settings and in the project settings, we have the first option, because the second is for the project deployment) [ Account ] - Account Management - SSH keys - Add key :

Adding a key to BitBucket
image

Well, then - just do what you need - either push or clone (it is assumed that you have already done git remote add yourself). Git will ask if you can add a host to trusted ones, and ask for a passphrase (private key password). Everything, you can work.

Successful developments!

PS: Many thanks for the tip-off on the decision to my colleague Ivan!

Source: https://habr.com/ru/post/266667/


All Articles