Now that I have my computer working, I want to get back at my github repositories. I could type my password with every push, but it's easier to use SSH with a key pair. Since I'm using Putty for shell access, I use Puttygen that comes with it. The problem is that Puttygen's format is not the right one for git. There are recommendations online to set $GIT_SSH
to use plink
with Pageant, which does use Puttygen's format, but I read that github won't support that, so I ended up doing the following:
Create a key pair with Puttygen. In the conversion menu, create a file in openSSH format. Create the file ~/.ssh/config
:
Host github.com
User git
IdentityFile /path/to/openssh-format-privatekey
At github.com add the public key that you created. Back in Powershell, in the directory with the local repository, do
git remote set-url origin git@github.com:username/repo-name.git
to use SSH. Now git push origin master
will push the local master branch back up to github without needed a password (if you created the private key with a passphrase, you will have to enter that.
In putty, for each host, set Host Name
in the Session
tab and select the private key (in Puttygen format!) in the Connection->SSH->Auth
tab.
Leave a Reply