Host github.com-jiggneshhgohel
HostName github.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_work_gmail
AddKeysToAgent yes
Host csexperimental.abc.com
IdentityFile ~/.ssh/id_work_gmail
AddKeysToAgent yes
References:
- https://stackoverflow.com/a/45562886/936494 - summarizes everything listed in this gist in form of steps which can be followed to resolve SSH agent issues.
- https://superuser.com/questions/1238486/windows-10-linux-subsystem-ssh-agent-not-persisting-added-identities#1238595 - This is the original post which details the issue I was facing
- https://unix.stackexchange.com/questions/269121/openssh-have-ssh-add-keys-to-agent-as-needed
- https://stackoverflow.com/a/41555393/936494 - This one I used to upgrade my SSH version
FROM
$ ssh -V
OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8, OpenSSL 1.0.1f 6 Jan 2014
TO
~$ ssh -V
OpenSSH_7.3p1 Ubuntu-1, OpenSSL 1.0.2g 1 Mar 2016
Howeve after existing the Bash session (the last console window) and logging-in again I get to the same position of requiring to re-add the keys to ssh agent using
ssh-add
command. Please refer the output below:If this has to go this way then there is no need to use a SSH config file. Adding the key once using
ssh-add
command makes the key to be used throughout the bash session until I exit the last console.