Ubuntu环境保持SVN密码

直接上脚本,执行完后重新登录一下终端

#!/bin/bash
if ! command -v gpg-agent &> /dev/null; then
    echo "not use gpg-agent,exit ..."
    exit 1
fi

num=`grep GPG_TTY ~/.bashrc -c`
if [ "$num" -eq 0 ]; then

        echo "export GPG_TTY=\$(tty)" >> ~/.bashrc
        echo "export GPG_AGENT_INFO=\`gpgconf --list-dirs agent-socket | tr -d '\\\n' && echo -n ::\`" >> ~/.bashrc
fi


mkdir ~/.gnupg/
echo "max-cache-ttl 60480000" > ~/.gnupg/gpg-agent.conf
echo "default-cache-ttl 60480000" >> ~/.gnupg/gpg-agent.conf
. ~/.bashrc
gpg-connect-agent updatestartuptty /bye
rm -rf ~/.subversion

echo "restar ssh will work"

 

posted on 2024-09-20 17:32  弘道者  阅读(128)  评论(0)    收藏  举报