Screen and ssh-agent

Someone in #lopsa mentioned that ssh-agent and screen were conspiring against them. I offer this as a possible solution:<

    function agentinfo {
        ssh-agent -s | head -2 > ${HOME}/ssh-agent-info
        . ${HOME}/ssh-agent-info
    }

    if [ -f ${HOME}/ssh-agent-info ];then
        . ${HOME}/ssh-agent-info
        if [ ! -S ${SSH_AUTH_SOCK} ];then
            unset SSH_AUTH_SOCK SSH_AGENT_PID
            rm ${HOME}/ssh-agent-info
        fi
    fi

Put the above code in your bourne(ish) shell and then run the following before starting your screen session:

    $ agentinfo
    $ ssh-add