Setup Git, ssh for Windows Easy and Quick!

There is some mistery around the setup of git and ssh in Windows. Especially as a fresh developer you might find yourself in this position where you just want to clone a repository from GitHub and you really try hard and create ssh-Keys and suddenly you try to checkout your code locally and you always get the message that your clone failed or your authorization failed. So let me give you a way that is easy and containable in a constant way!

Setting up Git

First of all you want to setup Git for Windows. In order to stay consistent through the parameters that are available let me share you the Chocolatey script. As you might remember Chocolatey is a package manager for windows. If you want to know more on how to install it and use it. I recommend reading through my last tutorial:

However I know you are as lazy as me so here goes the Chapter:

Install Chocolatey

If you haven’t heard it is like apt-get for Windows! Download that son of a package manager, it will make your life easier. If you have it continue to the next section! 

Run the following Script in an Administrator Powershell by typing “Powershell” in the start Menu -> Right Click on “Powershell” -> Run as Administrator:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(''))

That is it done next!

Installing Git

To install Git just use the Administrator Powershell as defined above and use the following code to install Git with Schannel (Windows Secure Channel Communications):

cinst git.install --params "/GitAndUnixToolsOnPath /NoGitLfs /SChannel" -y

You should now have a folder called “.ssh” in “C:\Users\YourUserName\.ssh” or for even easier access type: “%homepath%\.ssh” in your explorer. Here is the default directory where Git will search for ssh-keys. Lets create Keys!

Creating Keys

In order to create keys you will need the program PuttyGen I recommend installing it again through the Administrator Powershell using Chocolatey:

cinst putty -y

Now open GitHub and navigate to the SSH-Page as described in the following picture:

github insert key

github insert key

Now run the key-generator “puttygen” by typing:


Generate a new RSA-Key as described in the following picture and save the private Key and Public Key if you wish to use them in other applications.

Export the OpenSSH key as described in point 6 to the file: %homepath%\.ssh\id_rsa_github and copy-paste the contents of the Public-key Field to the new SSH-Key-Field in Github. The naming at the top is irrelevant.

puttygen generate key

puttygen generate key

Awsome now you are nearly finished! We just have to tell the .ssh config to use the provided ssh-key for the specified host.

Config SSH

In order to config ssh I created a file called “config” (without a file-ending) and opened it in the editor. Just paste the following code-snippet in the file and save it. This will route Git to use that specific key-file for the host

  IdentityFile ~/.ssh/id_rsa_github

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.