Use Git bash ssh tools on Windows from cmd

I needed ssh functionality for Windows cmd when using Git, but I do not want to use git bash. It turns out the git bash ssh tools also work from cmd. All you have to do is add the bin directory they are in to your path.

set path=%path%;"C:\Program Files\Git\usr\bin"

That’s it.

Adding a ssh public to Gitlab

I needed to add my ssh public key to Gitlab. Pretty straight forward generating it using PuttyGen and saving the public and private keys. When I pasted they public key into the dialog in Gitlab and hit “Add key” I got the following error.

The form contains the following errors:

  • Key is invalid
  • Key should be a single line
  • Fingerprint has already been taken
  • Fingerprint cannot be generated

I checked the public key and saw that it was not a single line. To correct this I did the following.

  • Deleted the “—- BEGIN SSH2 PUBLIC KEY —-” line
  • Deleted the “—- END SSH2 PUBLIC KEY —-” line
  • Deleted the “Comment: …” line
  • Removed all line ends from the generated key
  • Added “ssh-rsa ” before the key
  • Make sure there is an empty line after the key

That’s it.