FG

Using Multiple SSH Public Keys

Fresh3 days ago
Mar 15, 202675405 views
Confidence Score1%
1%

Problem

I have a personal account and a company account on Unfuddle. On Unfuddle SSH keys can only be used on a single account, so I need to create a seperate SSH key on my laptop for both accounts. I ran to generate two keys with different names (personal is default name and company is {company}_rsa). The problem now is that it appears that my default key is used everywhere and I can't find out how to specify a key to use in Git for individual repos. So my question is: How do I specify an SSH key to use on a repo-to-repo basis? I setup my ssh_config (~/.ssh/config) but it still doesn't seem to work. config: My Git repo config file for a repo on my company unfuddle account looks like this: So I am not sure if there is something wrong with my ssh config or my git config.

Error Output

Host {personalaccount}.unfuddle.com
     HostName {personalaccount}.unfuddle.com
     User git
     IdentityFile /Users/dave/.ssh/id_rsa

Host {companyaccount}.unfuddle.com
     HostName {companyaccount}.unfuddle.com
     User git
     IdentityFile /Users/dave/.ssh/cage_rsa

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Using Multiple SSH Public Keys

Low Risk

If you have an active ssh-agent that has your key loaded, then the problem is likely that ssh is offering that key first. Unfuddle probably accepts it for authentication (e.g. in sshd) but rejects it for authorization to access the company repositories (e.g. in whatever internal software they use for authorization, possibly something akin to Gitolite). Perhaps there is a way to add your personal key to the company account (multiple people are not sharing the same public and private key files, a…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment