I want to use other IdentityFile for git. I want to use it dynamically, not via config. I\'m doing this:
$ GIT_SSH_COMMAND=\'ssh -i /home/my_user/.ssh/id_ed255
I had the same issue with the recent Ubuntu version:
Using -vvv revealed following:
debug2: key: /home/ubuntu/.ssh/id_rsa (0x5628e48246d0), agent
debug2: key: /home/ubuntu/code/id_rsa (0x5628e4820af0), explicit
Adding -o IdentitiesOnly=yes
solved it.
Full git
command:
GIT_SSH_COMMAND='ssh -o IdentitiesOnly=yes -i /home/ubuntu/code/id_rsa -F /dev/null' git pull
Check you commands (is git called directly or through an alias) and configuration:
As I mention in "Using GIT_SSH_COMMAND", a git config -l might reveal other configuration that would override the environment variable.
Check the return of git config core.sshCommand
.
Finally, GIT_SSH_COMMAND
means Git 2.10+, so if your version of Git is too old, you will need to update it first.