toamitkumar's Code Blog

Ruby, Rails, RubyMotion, Chef, Puppet, Play and others. Opinions expressed here are my own and do not reflect those of my employer.

Permission Denied (Publickey)

| Comments

Adding the SSH keys on your github site is the simple solution. I am using 3 github sites; - 1 external - 2 behind the firewall

Each have their different email address for security reasons.

So, quite often, I get this error - if I mess up things. I was looking for a solution so that you can create a public rsa file for each github site.

The solution was to create config inside ~/.ssh directory.

The file:

Host 
  User git
  Port 22
  Hostname github-site1.com
  IdentityFile ~/.ssh/github_site1_id_rsa
  TCPKeepAlive yes
  IdentitiesOnly yes
  Hostname github-site2.com
  IdentityFile ~/.ssh/github_site2_id_rsa
  Hostname github-site3.com
  IdentityFile ~/.ssh/github_site3_id_rsa

Bingo !!

I am sure there are other better ways to solve this problem.

I would appreciate comments.

Comments