1

I have a Git repository that gets pushed to different remotes.

cd soCoolItHasToBeDuplicated;

git remote add foo git@github.com/...
git push foo;
git remote add bar git@github.com/...
git push bar;

Now, the repo has some SSH key configured.
But GitHub prevents the same SSH key to be reused for other user.
So I need to use other SSH key for the other repo.

There is the GIT_SSH_COMMAND var to use different SSH key. But I would like this to work transparently, without additional variable or script.

Basically what I am looking for is something like:

git remote set-key foo ~/.ssh/id_rsa-github-foo

Is there something such?
(I know GitHub specifically has organizations and stuff. I want a vanilla git solution.)

Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
  • 2
    Possible duplicate of [Multiple GitHub Accounts & SSH Config](https://stackoverflow.com/questions/3225862/multiple-github-accounts-ssh-config) – phd Sep 03 '18 at 20:45
  • *"But GitHub prevents the same SSH key to be reused for other user."* but github supports [deploy-keys](https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys) that you can share with other users. – Timothy Truckle Sep 03 '18 at 20:45

0 Answers0