I have multiple ssh config folders for various systems e.g.:
ssh -F ~/.ssh/system-a/config user@system-a
ssh -F ~/.ssh/system-b/config user@system-b
Each folder has a config file and set of identity files like so
Host system-a
HostName <some_hostname>
User <some_username>
IdentityFile ~/.ssh/system-a/keys/system-a.pem
How do tell git to use a certain ssh config file or a certain ssh key when performing git tasks?
Ideally I would like to do this per git project if I can.
on command-line you can change your Git config for the current repository:
or in
.git/config
in your local repository to the[core]
section:This works only with git 2.10 and newer. Otherwise, it needs to be set up using environment variable
$GIT_SSH_COMMAND
, for example like: