How to setup GIT with Putty on Windows?

Time needed: 20 minutes.

Setting up Git and putty can be tricky on Windows compared to Linux or Mac, but if you follow the steps in this guide, you should have no problems using Git on Windows.

  1. Download and install PuTTY

    PuTTY is a free software application for Windows 95, 98, XP, Vista, 7, 8 and 10 which can be used to make an SSH connection to your server. You can download the putty here.

  2. Download and install GIT

    Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. You can download the git here.

  3. Generate SSH keys

    If you don’t have an SSH public/private key pair you can generate it using the puttygen utility included with putty. Copy the OpenSSH version of your public key to the clipboard, you need this for the next step. Don’t forget to save both private and public keys.

  4. Add your SSH Key on Github / Gitlab / Bitbucket

    Register your generated public SSH key (OpenSSH version) on Github / Gitlab / Bitbucket. Do not share your private key anywhere.

  5. Run Pageant with the private key

    Run pageant.exe utility included with putty, find its icon inside your system tray and add your private SSH key. You may need to enter your passphrase for authentication.

  6. Add Environment variable

    To get git to use keys from putty, you need to add an environment variable (GIT_SSH) pointing to the location of plink.exe.

  7. Add fingerprint to known_hosts

    Run following commands and go through the process in command line prompt to add a fingerprint to the known_hosts file. Please change command according to your putty installation directory and git service provider.
    cd "C:\Program Files\PuTTY"
    plink.exe -v [email protected]

Use Git

Now you’re ready to actually use Git. From now you can clone repositories via git clone or push new code to Github / Gitlab / Bitbucket.