I’ve found myself having to do this on multiple machines and always seem to miss a step along the way. Over the years, I’ve ended up updating my approach and have updated the post accordingly (mentioning that in case you’re seeing something different from last time you checked this post). Here’s what I currently do:
- Install Git for Windows from here.
- Get Putty (including PuttyGen and Pageant) from here.
- I end up just getting the ZIP file package as I haven’t really needed to properly install the tools. Instead, I drop the files in a folder I have on my OneDrive so it’s on all of my machines.
- Open up a command prompt and create a new directory called .ssh in %userprofile%.
- Run PuttyGen to generate a new SSH key
- Remember to set a passphrase to keep things secure.
- Save the public and private key to the .ssh directory you created in the previous step. I name the key using the PC’s name as that’s how I reference all of my keys on the various services I use these with (e.g., VSTS, GitHub, GitLab, BitBucket).
- Set your system’s GIT_SSH environment variable to point to plink.exe (it’s a file that’s included in the Putty package you downloaded in step 2.
- Make pageant.exe auto-run on Windows startup (run the following from within the directory you saved the Putty files in):
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v Pageant /t REG_SZ /d "\"%cd%\pageant.exe"" /f
- Update the registry key you just created to include the path to the key file you just created by appending it to the command-line (yes, this could be merged into the previous step):
- Now you just need to add the public key to the services you want to use it with, and you should be good to go.