Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Asfand Qazi <ayqazi@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Trying to use insteadOf trick to use different SSH keys for separate github accounts - not working
Date: Sat, 16 Dec 2017 04:48:41 -0500	[thread overview]
Message-ID: <20171216094840.GA32706@sigill.intra.peff.net> (raw)
In-Reply-To: <CAFTSPUV1E+jCMHzx+rq9Y1agthxcYrzDVY-rThTNCG7BfnPeTg@mail.gmail.com>

On Sat, Dec 16, 2017 at 07:50:02AM +0000, Asfand Qazi wrote:

> I found out about the 'insteadOf' setting, and thought it would work.
> So I added this to my global git config:
> 
> [url "git@github.com:MyCompany/"]
> insteadOf = git@work.github.com:MyCompany/
> 
> and left the SSH hostname setting where it was. Then I tried doing:
> 
> git clone git:github.com/MyCompany/la-repo.git
> 
> But it won't work. With GIT_TRACE=2, I get:

If I'm reading it right, you have the config backwards. You want to
convert git@github.com from Go's invocation of Git into your special
"work" alias. So:

  [url "git@work.github.com:MyCompany/"]
  insteadOf = "git@github.com:MyCompany/"

-Peff

  reply	other threads:[~2017-12-16  9:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-16  7:50 Trying to use insteadOf trick to use different SSH keys for separate github accounts - not working Asfand Qazi
2017-12-16  9:48 ` Jeff King [this message]
2017-12-16 10:04   ` Asfand Qazi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171216094840.GA32706@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=ayqazi@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox