diff options
| author | Cameron McEfee <cameron@github.com> | 2011-05-27 16:25:16 -0700 |
|---|---|---|
| committer | Cameron McEfee <cameron@github.com> | 2011-05-27 16:26:19 -0700 |
| commit | 75e24fdca4e70e751332c491a4b60a712e12c9e0 (patch) | |
| tree | ce505c13238ac1243de1026f85f26f848cd16d26 /_posts/2010-01-19-multiple-keys.markdown | |
| parent | 379694ab364801b5d06c2070c43fa50594c4bf65 (diff) | |
Reorder files to alphabetize. Update titles to be more conducive to quick scans.
The posts have been re-dated to not only alphabetize them within their categories, but also to make them easier to find with their directory. Files marked 2008 are active post files. Files marked 2009 are outdated or are redirects to newer files. Files have been renamed to match their title for easier updating.
Diffstat (limited to '_posts/2010-01-19-multiple-keys.markdown')
| -rw-r--r-- | _posts/2010-01-19-multiple-keys.markdown | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/_posts/2010-01-19-multiple-keys.markdown b/_posts/2010-01-19-multiple-keys.markdown deleted file mode 100644 index 827d1ea..0000000 --- a/_posts/2010-01-19-multiple-keys.markdown +++ /dev/null @@ -1,49 +0,0 @@ ---- -layout: default -title: Multiple SSH keys -description: How to push using different SSH keys on the same computer -categories: intermediate ---- - -<p class="intro">This guide assumes you have already created two keypairs and attached them to different GitHub user accounts. For this example we will be using <code>~/.ssh/id_rsa</code> attached to the user <code>joe</code> and <code>~/.ssh/id_rsa_client</code> attached to the user <code>client</code>.</p> - -Adding your keys to SSH -======================= - -The first keypair, `~/.ssh/id_rsa`, uses a default name, so we don't need to do anything special to make SSH use this pair. The second pair, however, is not a default name. Therefore, we need to tell ssh about it so that it can use it: - -<pre class="terminal">ssh-add ~/.ssh/id_rsa_client</pre> - -If the keypair has a passphrase on it (it should!), `ssh-add` will ask you to enter the passphrase. After you have done this, the key will be available from ssh-agent so you won't have to re-enter the passphrase every time you use it. - -Configuring SSH -=============== - -Once SSH has access to both keys, you need to tell it which key to use for which server. In most cases you can assume that SSH will fall back to `~/.ssh/id_rsa` by default, but we're going to force it anyway. To begin, open `~/.ssh/config` in your favorite editor. - -{% highlight bash %} -# Default GitHub user (joe) -Host github.com - HostName github.com - User git - IdentityFile /Users/joe/.ssh/id_rsa - -# Client user (client) -Host github-client - HostName github.com - User git - IdentityFile /Users/joe/.ssh/id_rsa_client -{% endhighlight %} - -In short what this does is tells SSH to use the client key when connecting to the server github-client, which is really github.com. - -Using the second key -==================== - -From here on, everything is the same as everyday use except for one component, the domain name. When working on a repo owned by the primary account, we would use a command like: - -<pre class="terminal">git clone git@github.com:joe/my_repo.git</pre> - -When we want to use the second account's key, however, we need to change the domain name. Doing so will use the settings in `~/.ssh/config` to override the defaults. - -<pre class="terminal">git clone git@github-client:client/his_repo.git</pre> |
