📜 ⬆️ ⬇️

Git friends with Putty

Disclaimer
Previously did a search on Habra with the hope of such a post, I could only find this post, in which all the work is done through TortoiseGit.

But this is not our method. For the reason that in this case all our IDEs will not be able to do Push to the server themselves. Yes, and through Git Bash nothing can be done on the server.
Why do I need to use Git in conjunction with Putty?
It so happens that I actively use Putty with configured keys to access the servers. My keys are not alone. Git repositories are not alone either.
Of course, you can build OpenSSH keys for Git and resolve them through ~ / .ssh / config, but this turns out to be a double work - key support in Putty and separate support for Git.



So, imagine that we have a pristine clean system, in which there is neither Putty nor msysgit. Let's start setting up our working environment.
')

Install putty


Download , install, generate and configure the key with Pagent ( instruction ,? ).

Add key to git server


We copy public OpenSSH key from Putty-key
Run the Putty key Generator
Open (button "Load") our PPK-key
Copy all the text from the block "Key"

Open a page with SSH keys and add our key from the buffer
In pictures (using GitHub as an example)






We create and save the “git@github.com” profile in Putty and check that it is possible to log in using the key — the console should open and close immediately.
In pictures





Install and configure msysgit


We download and install in the “next, next, next” mode with a slight departure from the dialogs:
1) Add commands to the context menu of Windows Explorer
2) Specify that we will use Putty instead of OpenSSH
In pictures









And I already have msysgit installed - how can I reconfigure it?
Option times: reduction - remove and re-install.
anecdote to the topic:
Physicist outraged:
- See how these mathematicians solve problems!
Task 1:
“Given: an empty kettle, a tap with water, a stove.
Required: boil water.
Solution: take the kettle, open the tap, draw water, put on the stove, wait for boiling. Problem solved. ”
Task 2:
“Given: a kettle with water, a tap with water, a stove.
Required: boil water.
Solution: take the kettle, pour out the water. The task comes down to the previous one. ”

Option two: add to the environment the variable GIT_SSH, in which specify the path to plink.exe



And the final step is to verify that the Git console also uses the Putty key.
Run Git Bash and push to remote repository.
In pictures




Bun: in order to use it in IntelliJ IDEA, it is enough to switch from “Built-in” to “Native”

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


All Articles