./install_git_credentials.sh
命令步骤:
touch ~/.git-credentials
echo "http://$username:$password@$localhost" >> ~/.git-credentials
git config --global credential.helper store
总结成脚本如下:
#! /bin/bash
# Edit by liu.bao.long.vk@gmail.com
echo '##################################################'
echo '###该脚本可以永久的配置http和https协议的git密码###'
echo '### power by liu.bao.long.vk@gmail.com###'
echo '##################################################'
echo '请输入remote url, 例如:"http://example.com"'
read localhost
echo "请输入username"
read username
echo "请输入password"
read password
if test -e ~/.git-credentials
then
echo '!!~/.git-credentials already exist!'
else
echo 'Create ~/.git-credentials..'
touch ~/.git-credentials
fi
echo 'Configure username and password..'
echo "http://$username:$password@$localhost" >> ~/.git-credentials
git config --global credential.helper store
echo 'Sucess!'
密码一个小时之后失效
git config credential.helper 'cache --timeout=3600'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)