How to use Git with RSA key on Windows

If you want to use Git on Windows it’s recommendet to connect it to putty using SSH.
Further if you authenticate with RSA keys instead of username/password, there may appear a few issues.

Setup Client:

The most bothering one is the generation of the RSA keys. One way that works is the following:

  1. Install the used applications: Putty, Git and optional TortoiseGit
    Update 2018: I really do not recommend using TortoiseGit (and I never should have). There are way better tools to do this. Furthermore Atom and Visual Studio Code have good version controll features included.
  2. Use the Git-Bash to create an RSA key (described on github)
  3. Convert the created private key (on default stored at C:\Users\CURRENT_USER\.ssh\id_rsa with Puttygen) to a putty-private-key (.ppk) using puttygen
  4. In puttygen Save Private Key. Use this key to authenticate on git Server

Setup Server

To be able to connect to the Git repository the user’s public key must be inserted into the authorized_keys.
Therefore the content of the public of the RSA key inside the unchanged file created by the Git Bash must be appendet to the git-user’s keyring on the git server.

This code is described on the official Git-page.

su git
cat /tmp/ >> ~/.ssh/authorized_keys
chmod -R go= ~/.ssh

That’s it. Have fun working with Git.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.