February 9, 2018
Shell:自动无密码提交git, cron git push with ssh key, 无密码提交git 到 Bitbucket或者GitHub
定时任务:
0 0 * * * /home/username/Sites/git/repo/commit.sh
commit.sh 文件
#!/usr/bin/env bash
GIT=`which git`
REPO_DIR=/var/www/html/
cd ${REPO_DIR}
${GIT} add -u .
${GIT} commit -a -m "Daily Crontab Backup at "$(date "+%Y-%m-%d %H:%M:%S")
${GIT} push -u origin master
实现步骤
1. 生成密钥:
cd ~/.ssh/ #Your ssh directory
ssh-keygen -t rsa -f my_rsa -C "yo…