sshagent + git checkout doesn't seem to work: the `SSH_AUTH_SOCK` env var disappears from the git process environment, and thus the ssh-agent is not available to ssh started by git...
- create a ssh key credentials `ssh-key`
- create a pipeline job with Jenkinsfile:
- run created job
ssh started by git finds the correct ssh key via the ssh agent.
- git fetch fails : no valid ssh key found
- `ssh-add -l` works though, and shows the key added by `sshagent`
- `checkout` scm instead of `git` command: same behavior: it fails to find the key
- direct `sh 'ssh -vvv email@example.com'` works
- configure a git wrapper as `git` tool in global jenkins config to observe what happens:
- run job again
- `ssh-add -l` fails: "Could not open a connection to your authentication agent."
- `printenv` shows `SSH_AUTH_SOCK` env var is not here, which explains why the ssh agent is not usable/used
So the remaining question is: why is the `SSH_AUTH_SOCK` env var removed when executing git commands ?