Is it possible to connect to a web server and then connect to a git server using SSH agent if the second hop needs a different user?
It works if I pass in the user name explicitly.
$ ssh web.example.com
# connects
> ssh -T yellow@git.example.com
> # connects
It does not work if I rely on the SSH config to set user.
$ ssh web.example.com
# connects
> ssh -T git.example.com
> # permission denied
Here is the SSH config on my machine.
Host web.example.com
User blue
ForwardAgent yes
Host git.example.com
User yellow
In the debug output it says authenticating as blue
even though the config sets the user to yellow
for the host.
debug1: Authenticating to git.example.com:22 as 'blue'
Why does it use the wrong user? I don't want to hard code the user because then it does not work for the whole team to use the same deploy script.