Ubuntu环境保持SVN密码

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

#!/bin/bash
num=`svn auth|grep gpg-agent -c`
if [ "$num" -eq 0 ]; then
        echo "not use gpg-agent,exit ..."
        exit
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

 

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