Trying to use insteadOf trick to use different SSH keys for separate github accounts - not working

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Here's what I'm trying to do, that i need your help with to make work:

I have 2 github accounts, each with their own SSH key: my home account
(default SSH key) and my work account (alternative SSH key). I can
create a virtual hostname in my ~/.ssh/config like so:

Host work.github.com
     Hostname github.com
     IdentityFile ~/.ssh/id_rsa-work

and then clone repos with:

git clone git@xxxxxxxxxxxxxxx/MyCompany/la-repo.git

However, I'm trying to use Go, which needs to access every repo host
as 'github.com', and won't support my little SSH hostname trick by
default.

I found out about the 'insteadOf' setting, and thought it would work.
So I added this to my global git config:

[url "git@xxxxxxxxxx:MyCompany/"]
insteadOf = git@xxxxxxxxxxxxxxx: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:

$ GIT_TRACE=2 git clone git@xxxxxxxxxx:MyCompany/la-repo.git
07:46:27.627557 git.c:344               trace: built-in: git 'clone'
'git@xxxxxxxxxx:MyCompany/la-repo.git'
Cloning into 'la-repo'...
07:46:27.629623 run-command.c:626       trace: run_command: 'ssh'
'git@xxxxxxxxxx' 'git-upload-pack '\''MyCompany/la-repo.git'\'''
ERROR: Repository not found.
fatal: Could not read from remote repository.

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


Can anyone help me with this?

Thanks

Regards,
     Asfand



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux