April 21, 2023
If you want to use multiple GitHub accounts, and have your ssh keys stored
in 1Password, the environment variable
GIT_SSH_COMMAND can be used as an alternative to modify your
For example if you need to use
project1 define it like this:
export GIT_SSH_COMMAND="ssh -i ~/.ssh/key1.pub -F none"
you can add it to your
.envrcand make it global for all projects within a directory.
-F none or
-F /dev/null makes that no configuration file will be read.
If you then do:
ssh -T [email protected]
It will use the key from user
key1 without the need to modify to changte the git URL.