Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tobimax/0c278c4aaba8c661e6a80f400b45ffbc to your computer and use it in GitHub Desktop.
Save tobimax/0c278c4aaba8c661e6a80f400b45ffbc to your computer and use it in GitHub Desktop.
Git SSH Configuration on Windows

Git SSH Configuration on Windows

Get Git for Windows

from Git for Windows home

Install Git

Use the following options:

  • Run Git and included Unix tools from the Windows Command Prompt
  • Use OpenSSH

Set HOME Environment Variable

In order to allow OpenSSH to find your keys in the default location $HOME/.ssh/id_rsa its required to set the $HOME environment variable.

set HOME=%USERPROFILE%    

Generate SSH Keys

c:\ssh-keygen -t rsa -C "[email protected]

You will be prompted for a file name:

Enter file in which to save the key (/c/Users/YOUR_USER_NAME/.ssh/id_rsa):

ATTENTION:

  • If the suggested path is //.ssh/id_rsa most probably the environment variable HOME is missing on your system. Fix: set HOME=%USERPROFILE%
  • Use Unix style path syntax /c/Users/YOUR_USER_NAME/.ssh/id_rsa instead of Windows style c:\users\YOUR_USER_NAME.ssh\id_rsa
  • The directory (.ssh) whereto the keyes should be created should exist. But the key file should not exist.

Add Public SSH Key to GitHub

  • Open the public key file file c:\users\YOUR_USER_NAME.ssh\id_rsa.pub in a text editor
  • Open the open the SSH section of your GitHub settings https://github.com/settings/ssh.
  • Press Add SSH key
  • Copy the whole text of the id_rsa.pub from the editor into the key text area and finish with Add key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment