Skip to content

Instantly share code, notes, and snippets.

@Peoplecantfly
Last active February 29, 2016 06:22
Show Gist options
  • Select an option

  • Save Peoplecantfly/b4129d1ce07b2acfc3df to your computer and use it in GitHub Desktop.

Select an option

Save Peoplecantfly/b4129d1ce07b2acfc3df to your computer and use it in GitHub Desktop.

If you are getting a "Permission denied (publickey)." error when trying to push or clone your repo.

That what i do to store all my ssh keys in separate folders on windows.

  1. You need to create a ssh key. To do this run ssh-keygen -t rsa -C "your_email@example.com" command, when it promt for location - enter valid path to file where you whant to store them, like this: Enter file in which to save the key (/c/Users/nikol//.ssh/id_rsa): /d/Documents/SMTH/SSH/github/id_rsa. This will create both id_rsa and id_rsa.pub.
  2. Copy content of id_rsa.pub to your GitHub account ssh-keys settings.
  3. Check your HOME variable. In cmd run echo %HOME%. If there is no HOME path, just create it for current user. You need to create %HOME%\.ssh\config file, if .ssh folder does not exists - create it. Add to config file this lines (IdentityFile is the path where you store your id_rsa in first step.):
        Host github.com  
                Hostname github.com  
                User git  
                IdentityFile /D/Documents/SMTH/SSH/github/id_rsa

To check that all works run ssh -T git@github.com in cmd. It should congratz you with successfully authenticatiuon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment