Skip to content

Instantly share code, notes, and snippets.

@jkbrzt
Created January 2, 2015 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkbrzt/74d77a05be750024d88d to your computer and use it in GitHub Desktop.
Save jkbrzt/74d77a05be750024d88d to your computer and use it in GitHub Desktop.
Ansible task to verify that it's possible to login to github.com via SSH using forward agent
- name: Verify GitHub SSH login
tags:
- debug
- deploy
shell: |
ssh_output=$(ssh -T git@github.com &>/dev/stdout)
echo
echo Should not be empty:
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
echo
echo "ssh git@github.com => $ssh_output"
echo
if ! grep -q "successfully authenticated" <<< "$ssh_output"; then
echo
echo !!!GitHub error: SSH login failed!!!
echo Make sure your GitHub account public key authentication is working,
echo and that SSH agent forwarding is configured on your system.
echo https://developer.github.com/guides/using-ssh-agent-forwarding/
echo
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment