Tag Archives: SSH

Using SSH keys with BitBucket/GitHub on Windows

Couldn’t get this to work, but now it does, so… time for another “note to self”. 🙂

Prerequisites

  • Git, obviously…
  • PuTTY, with puttygen, plink and pageant, to be exact…

Setup

  1. Open puttygen.
  2. Load your private key, or generate a new one and save it.
  3. Copy your public key (“Public key for pasting …”) to BitBucket/GitHub/etc.
  4. Open pageant
  5. Load your private key.
  6. Check that the key authentication works by running e.g.
    plink -v git@bitbucket.org
    plink -v git@github.com
  7. Point the GIT_SSH environment variable to plink.exe.

Now, as long as pageant is running with your private key loaded, it should work to clone, pull, push, etc. to/from both private and public repos. E.g. git clone git@github.com:example/some-private-repo.git.

Key here, for me, was the GIT_SSH variable that so many blogs, StackOverflow answers and forum posts failed to mention… Without that set, the plink check did still work, but git clone did not. It just failed with an authentication error. With that variable set it now works perfectly. 🙄🙂👍

Sources: makandracards.com, vladmihalcea.com

External tool definitions for mRemoteNG

Here are some external tool definitions I have defined in mRemoteNG.

WinSCP

Display name

WinSCP (sftp)

Filename

C:\Program Files (x86)\WinSCP\WinSCP.exe

Arguments

sftp://%username%:%password%@%hostname%:%port%/

Ping

Display name

Ping

Filename

cmd

Arguments

/c ping -t %HostName%

Traceroute

Display name

Ping

Filename

cmd

Arguments

/c set /P = | tracert %HostName%

More can be found at the mRemoteNG forum.

If you haven’t tried mRemoteNG, you should. It’s very handy if you’re on Windows and need to connect to various servers through for example SSH and RDP. Sure beats plain PuTTY at least…