Emacs With GitHub And SSH On Windows


Setting up SSH for GitHub so that git doesn't constantly ask you for a password.

Emacs With GitHub/Bitbucket And SSH On Windows

It's nice to be able to seamlessly use Emacs with GitHub/Bitbucket from the command line. I had a little trouble getting it to work initially. Using the below references, here are the steps I came up with.

  • https://github.com/magit/magit/wiki/Pushing-with-Magit-from-Windows
  • http://stackoverflow.com/a/17051410/959699

  • Use puttygen to generate the key.

    • Save both the public and private key to somewhere safe on your hard drive.
  • Save a new version of the public key, removing everything except the key text string.
  • In the new public key file, prefix they key with ssh-rsa followed by one space and a carriage return.
  • Don't use emacs to copy the key from the file, paste it into the area provided in the github/bitbucket settings
  • Add private key to Pageant
  • Set GIT_SSH to use plink
    • Mine is here: c:\ProgramData\chocolatey\lib\putty.portable\tools\PLINK.EXE
  • The first time pushing, push using git push origin yourbranch to have putty store the server's fingerprint.
  • Restart emacs

EDIT: You can in store passwords using wincred helper in latest git and have git present user with a minimal popup dialog when required. This means you can make https remotes just as convenient as ssh remotes on windows.

Steps To Add A Project