<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dw="https://www.dreamwidth.org">
  <id>tag:dreamwidth.org,2010-09-03:573632</id>
  <title>Morgan Nametbd</title>
  <subtitle>Morgan Nametbd</subtitle>
  <author>
    <name>Morgan Nametbd</name>
  </author>
  <link rel="alternate" type="text/html" href="https://stormerider.dreamwidth.org/"/>
  <link rel="self" type="text/xml" href="https://stormerider.dreamwidth.org/data/atom"/>
  <updated>2013-08-05T04:31:02Z</updated>
  <dw:journal username="stormerider" type="personal"/>
  <entry>
    <id>tag:dreamwidth.org,2010-09-03:573632:190001</id>
    <link rel="alternate" type="text/html" href="https://stormerider.dreamwidth.org/190001.html"/>
    <link rel="self" type="text/xml" href="https://stormerider.dreamwidth.org/data/atom/?itemid=190001"/>
    <title>Git with an alternate SSH key&amp;#8230;</title>
    <published>2013-08-05T04:24:54Z</published>
    <updated>2013-08-05T04:31:02Z</updated>
    <category term="git"/>
    <category term="ssh"/>
    <category term="ssh-agent"/>
    <category term="bitbucket"/>
    <dw:security>public</dw:security>
    <dw:reply-count>0</dw:reply-count>
    <content type="html">&lt;p&gt;So I use &lt;a href="http://bitbucket.org"&gt;BitBucket.org&lt;/a&gt; both for my day job, and also for managing my private Git repos. (Since BB is free for personal private repo use, whereas GitHub charges for that&amp;#8230;)&lt;/p&gt;
&lt;p&gt;However, when I go to push to BitBucket for my personal use, I need to make sure that my SSH keys for work aren&amp;#8217;t loaded. This has resulted in me doing things like &amp;#8220;ssh-add -D&amp;#8221; to wipe out all the keys in my ssh agent, then manually loading my personal key for git use. Then when I start work again, I have to reload my other keys. Rather annoying.&lt;/p&gt;
&lt;p&gt;I came across a solution here: &lt;a href="http://noamlewis.wordpress.com/2013/01/24/git-admin-an-alias-for-running-git-commands-as-a-privileged-ssh-identity/"&gt;git admin: An alias for running git commands as a privileged SSH identity&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;However, it didn&amp;#8217;t work for me. Took a bit to figure out why, but it came full circle back to the use of ssh-agent&amp;#8211; even though I was properly specifying my SSH identity file, the keys from my ssh-agent were being seen first. All I had to do was to disable the use of ssh-agent inside of the ssh-as.sh script, like so:&lt;/p&gt;

&lt;div style="bgcolor: #fff"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="code"&gt;&lt;pre class="bash" style="font-family:monospace;"&gt;&lt;span&gt;#!/bin/bash&lt;/span&gt;
&lt;span&gt;set -e&lt;/span&gt;
&lt;span&gt;set -u&lt;/span&gt;
&amp;nbsp;
&lt;span&gt;unset SSH_AUTH_SOCK&lt;/span&gt;
&lt;span&gt;ssh -i $SSH_KEYFILE $@&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That did the trick for me. Hope that helps someone else out there as well!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=stormerider&amp;ditemid=190001" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
</feed>
