Here are a few solutions:
-
Add an entry to your
~/.ssh/config. For example:Host bitbucket.org IdentityFile ~/.ssh/bitbucket_key IdentitiesOnly yes -
Use
ssh-agentand add your key to the agent instance beforehand. -
Use something like ssh-ident for choosing ssh agents and identities dynamically based on the current working directory or arguments passed to ssh-ident. As their readme states, you would typically alias ssh-ident to
sshso that it’s automatically used everywhere.