我想知道是否有办法让bashrc自动为git添加你的凭据。
当我使用git bash时,我总是必须执行' ssh-add C:/ Users / ... / ...然后在我开始之前添加密码。
有没有办法设置该文件以自动添加该信息?或者只是一般来说,bashrc看起来像是攻击的地方,但我不确定。
当前的bashrc是这样的:
SSH_ENV="$HOME/.ssh/environment"
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
ssh-agent | sed 's/^echo/#echo/' > "$SSH_ENV"
echo succeeded
chmod 600 "$SSH_ENV"
. "$SSH_ENV" > /dev/null
ssh-add
}
# test for identities
function test_identities {
# test whether standard identities have been added to the agent already
ssh-add -l | grep "The agent has no identities" > /dev/null
if [ $? -eq 0 ]; then
ssh-add
# $SSH_AUTH_SOCK broken so we start a new proper agent
if [ $? -eq 2 ];then
start_agent
fi
fi
}
start_agent
谢谢!