SSH auth for multiple GitHub accounts on OSX > stdout.in Ievgen Kuzminov IT blog

SSH auth for multiple GitHub accounts on OSX

Jun 29, 2016, 9:37:56 AM

When you use more than one SSH key to access GitHub you can use primary account by default and additional, with such a config (assume your second SSH key file is ~/.ssh/id_rsa_pewpew)

Host github-pewpew
  HostName github.com
  IdentityFile ~/.ssh/id_rsa_pewpew

With Linux having ssh key in .ssh folder and configuring ~/.ssh/configis enough. But on MacOS I get an error during Git clone (and Capistrano deploy) like this:

git clone git@github-pewpew:.../...git
Cloning into 'MyRepo'...
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

a bit confusing, but an error is not with Repo by itself (if you are completely sure that you are the repo owner or have write-rights).

Solution

On MacOS X I need to additional keys manually by

$ ssh-add ~/.ssh/id_rsa_pewpew

and you can check what key are in use right now

$ ssh-add -l

Note

On MacOS X you will need to add key after every system restart. It looks like we need to use OSX Keychain to reload them authomatically via

$ ssh-add -K [path/to/private SSH key]

comments powered by Disqus
Ievgen
Kuzminov "iJackUA"
Web Team Lead
at MobiDev (Kharkiv, Ukraine)
Code in Ruby and Elixir, but still love PHP. Explore ES6 and Vue.js. Explore databases, use Ubuntu and MacOS, think about IT people and management

Notes


Linkify - jQuery plugin for finding URLs in plain-text and converting them to HTML links. It works with all valid URLs and email addresses



Remodal - flat, responsive, lightweight, fast, easy customizable modal window jquery plugin with declarative state notation and hash tracking



Giving a try to Ubuntu 14.04 - so far it's ok. More stable and refined. But it seem to have problems with Cinnamon 2 installation. Oh fine... will wait for Linux MInt 17 to use on my Work machine



Updated blog. Mostly "under-the-hood" changes according to latest Yii2 state, some CSS and server optimisations. In case of any issues please feel free to comment here