I am working on terraform modules in private git repos. I use my default ssh key(
~/.ssh/id_rsa) on macOS for my own personal git repos.
GitHub does not allow using same key for other git account. I created another ssh key pair and uploaded to GitHub. But
git clone or
terraform init still uses default key pair. Running ssh-agent and adding my new key to ssh agent with ssh-add did not help.
GIT_SSH_COMMAND env variable.
Create new ssh key, Add new public key to Github and set
$ ssh-keygen -t rsa -f ~/.ssh/mynewssh
$ export GIT_SSH_COMMAND="ssh -i ~/.ssh/mynewssh"
$ ssh-add ~/.ssh/mynewssh
$ terraform initon Fish shellset -gx GIT_SSH_COMMAND "ssh -i ~/.ssh/mynewssh"