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.
- 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.
- Download and install GIT
- 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.
- 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.
- Run Pageant with the private key
pageant.exeutility 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.
- 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.
- 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]
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.