How to use linux generated keys on windows with tortoise git?

  • 1 year ago
Comment

ChatGPT
1 / 1

Using Linux-generated SSH keys on Windows with TortoiseGit involves exporting the keys from Linux and then configuring TortoiseGit to use those keys for authentication. Here's a step-by-step guide:

  1. Export SSH Key from Linux:
    If you haven't already, generate your SSH key pair on Linux using the ssh-keygen command. Once the keys are generated, you'll have a private key (id_rsa) and a public key (id_rsa.pub). To export the private key, you'll need to convert it to the OpenSSH format that Windows can understand.

    On Linux, run the following command to convert the private key:

    sh
    ssh-keygen -e -f ~/.ssh/id_rsa > id_rsa_openssh

    This will create a file named id_rsa_openssh containing the private key in OpenSSH format.

  2. Transfer Keys to Windows:
    Transfer the id_rsa_openssh private key and the id_rsa.pub public key files to your Windows machine. You can use tools like scp or simply copy the files using USB drive, email, or any other method you prefer.

  3. Configure TortoiseGit:
    TortoiseGit uses the PuTTY SSH client by default, so you'll need to convert the private key from OpenSSH format to PuTTY format using the PuTTY Key Generator (puttygen).

    • Install PuTTY if you haven't already: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
    • Open PuTTY Key Generator (puttygen).
    • Click "Conversions" in the menu bar and choose "Import key."
    • Select the id_rsa_openssh file that you transferred from Linux.
    • PuTTY Key Generator will prompt you to save the converted private key. Save it with a .ppk extension.
  4. Configure Pageant for Authentication:
    TortoiseGit doesn't directly support OpenSSH keys, but you can use the PuTTY agent, Pageant, to manage the authentication process.

    • Open Pageant from the PuTTY installation folder.
    • Right-click the Pageant icon in the system tray and select "Add Key."
    • Add the converted .ppk private key that you saved using PuTTY Key Generator.
  5. Configure TortoiseGit to Use Pageant:
    Configure TortoiseGit to use Pageant for authentication.

    • Open TortoiseGit settings.
    • Go to "Network" > "SSH Client."
    • Select "PuTTY/Plink" as the SSH client.
    • Set the path to plink.exe from the PuTTY installation folder.
    • Check the "Use PuTTY private key" box and select the .ppk private key you added to Pageant.

Now TortoiseGit on Windows should be able to use the Linux-generated SSH key pair for authentication. When you clone or interact with remote repositories, TortoiseGit will use Pageant for key-based authentication.

Remember to keep your private key (id_rsa_openssh or the converted .ppk) secure and do not share it publicly.