Here i’ve explained how to use TortoiseGit Windows Client to commit, push, pull a GitHub repostiory ove SSH Using its (Public & Private RSA Keys).

You should also see https://vladmihalcea.com/tutorials/git/windows-git-ssh-authentication-to-github/

  • Install PuTTy (a ssh and telnet client) by extacting its download
  • There are four important tools in putty, which are as follows:
    • *Putty* is a SSH and Telnet Client
    • *Plink* is a CLI (Command Line Interface) for PuTTY
    • *Pagent* is a SSH authentication agent for PuTTY, PSCP, PSFTP, and Plink.
    • *Puttygen* is an RSA and DSA key generation utility.
  • Whenever we generate RSA Keys, following files are created
    • Private Keys = *id_rsa* and *id_rsa.ppk*
      • Never send your private keys to anybody, keep then secured.
      • In Linux your keys needs to be in ~/.ssh folder
      • In Windows your keys needs to be C:\Users\sagupta\.ssh\
    • Public Keys = *id_rsa*

Configuring PuTTY & TortoiseSVN with GitHub (SSH)

  • Install windows Git Client and ensure to choose plink's path during install.
  • Add enviornment variables GIT_HOME and GIT_SSH to system and modify PATH
    • GIT_HOME = C:\Program Files\Git
    • GIT_SSH = C:\Program Files (x86)\PuTTY\plink.exe
    • Path = %Path%;%GIT_HOME%\bin
  • Open pagent.exe and load ppk keys ~/.ssh/id_rsa.ppk (linux) or C:\Users\sagupta\.ssh\putty_private.ppk (windows)
  • Keep pagent running in system background with key loaded. During key loading you’ve to enter password of private key
  • Open putty.exe on Connection->SSH->Auth enter ppk key located at ~/.ssh/id_rsa.ppk (linux) or C:\Users\sagupta\.ssh\putty_private.ppk (windows)
  • Using putty.exe test connection with host git@github.com:22 (or via command ssh-agent ssh -Tv git@github.com)
  • For bitbucket use git@bitbucket.org:22 (or via ssh-agent ssh -Tv git@bitbucket.org) for testing connection
  • In system settings of github client add following code, signiningkey value to be replaced with personal access token generated from github

[user] name = Sachin Gupta email = sachin.aut@gmail.com signingkey = 813a97892ff5f726e8c58a692de4dc91a07cfea7

  • You need to enter password your signiningkey othewise wrong email will be put for authentication and things will fail.
  • This signiningkey token dissappears after first commit, See Basis
  • If you run git remote -v this will show current repository url, you’ll see https:// as default which only works with OAuth Token
  • We’re going to change git access from https:// to ssh:// so that client will work with ssh and this will use keys mentioend earlier
  • For changing execute git remote set-url origin git@github.com:gitusername/gitrepositoryname.git as per reference
  • This value is something like git remote set-url origin git@github.com:sachin-gupta/sachin-gupta.github.io.git
  • Once again is we check git remote -v this will show ssh url’s for fetch and push setup

origin https://github.com/sachin-gupta/sachin-gupta.github.io.git (fetch)
origin https://github.com/sachin-gupta/sachin-gupta.github.io.git (push)