只是存一些代码。
首先装一下git
apt-get install git
然后
git config --global user.name "Your Name Here" # Sets the default name for Git to use when you commit
git config --global user.email "your_email@example.com" # Sets the default email for git to use when you commit
如果不存在现在的key
cd ~/.ssh
然后
ssh-keygen -t rsa -C "your_email@example.com" cat ~/.ssh/id_rsa.pub
上传到github的public key
copy -> Github -> Account -> SSH Key -> Add SSH Key
然后就可以clone了
git clone git@github.** git add . git commit -m "Added notes for $(date)" git push -u origin master
然后/etc/profile设置
if [ -x /usr/bin/keychain ]; then /usr/bin/keychain --quiet --clear $HOME/.ssh/id_rsa fi
写一点shell脚本
. /etc/profile . ~/.keychain/`/bin/hostname`-sh cp -ru backup_folder dest # copy to destination folder cd dest git add . git commit -m "Added notes for $(date)" git push -u origin master #push to github
最后设上crontab就好啦
2 replies on “linux下自动同步到github”
楼主要是熟练git命令,可以直接commit到github上去!