You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context:
I have multiple accounts (eg work vs personal) I use for sites (eg, github.com). Each are tied to different SSH keys. I'm on Windows, but setup devContainers to wrap my projects. Some are for personal, and some for work. Within the host, I can just configure multiple accounts like so:
~/.ssh/config:
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/github/personal-account
Host work-github
HostName github.com
User git
IdentityFile ~/.ssh/github/work-account
If I do a normal clone from github using git clone command, it will use my personal account. If I want to clone down using my work profile, it will be like so:
Problem:
When I use a devContainer, I setup ssh-forwarding so I can add keys and not have it stored into the container image. However, if I try the git clone using work account, it will not find the correct SSH key to use. I can confirm the keys are forwarded (using ssh-add -l). I could also try to create ~/.ssh/config and tell it to use a specific key -- but it will require a link to a private key file that doesn't exist inside the devContainer. Is there a way to link the IdentityFile to the key forwarded from ssh-forwarding? Or what other options do people do to work around this? Ideally I don't want to be having my private key stored/copied in multiple places on my system and containers.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context:
I have multiple accounts (eg work vs personal) I use for sites (eg, github.com). Each are tied to different SSH keys. I'm on Windows, but setup devContainers to wrap my projects. Some are for personal, and some for work. Within the host, I can just configure multiple accounts like so:
~/.ssh/config:
If I do a normal clone from github using git clone command, it will use my personal account. If I want to clone down using my work profile, it will be like so:
Problem:
When I use a devContainer, I setup ssh-forwarding so I can add keys and not have it stored into the container image. However, if I try the git clone using work account, it will not find the correct SSH key to use. I can confirm the keys are forwarded (using ssh-add -l). I could also try to create ~/.ssh/config and tell it to use a specific key -- but it will require a link to a private key file that doesn't exist inside the devContainer. Is there a way to link the IdentityFile to the key forwarded from ssh-forwarding? Or what other options do people do to work around this? Ideally I don't want to be having my private key stored/copied in multiple places on my system and containers.
Beta Was this translation helpful? Give feedback.
All reactions