The title mostly says it all. I have a couple of wrinkles, though...
I have a work account and I have a personal account. I primarily develop node.js projects and I like to divide my projects up into multiple repositories so I can share code. Some projects are included in other projects as packages via
yarn add git+ssh://git@bitbucket.org:my_team/my_useful_package.git#1.0.0
I've seen several solutions for using multiple accounts, such as
1. modifying the ssh configuration to specify different hostnames and pulling from those modified hostnames, eg. https://blog.developer.atlassian.com/different-ssh-keys-multiple-bitbucket-accounts/
2. setting up new SSH keys and pulling using a username, as in https://confluence.atlassian.com/bitbucket/set-up-additional-ssh-keys-271943168.html
3. specifying which ssh key to use in the .git repository config via
git config core.sshCommand "ssh -i ~/.ssh/id_rsa_example"
(eg. https://superuser.com/a/912281/340670)
The problem with the first two is that they require changes to my ssh config on two machines (work and home) and changes to my package.json. The problem with the last one is that when I install my node packages, that SSH command is not used.
The ideal solution would be to allow the use of the same SSH key on two different accounts. The solution I am using is to manually tweak my SSH config when switching from work to personal projects (which works OK because there's no overlap between work and play time).
Has anyone come up with a better solution?