Allowing the ssh-agent being forwarded when using the sudo command.
sudo
Append the following to the file /etc/sudoers. Better create a file env_keep in /etc/sudoers.d/.
/etc/sudoers
env_keep
/etc/sudoers.d/
# Pass SSH socket on sudo command. Defaults env_keep+=SSH_AUTH_SOCK