github用于备份

github用户名 mygituser001
github用户邮箱 [email protected]

命令行生成
ssh-keygen -t rsa -b 4096 -C "[email protected]"
打开生成的pub文件
内容类似
ssh-rsa AAAAB3**************w== [email protected]

点击头像边的箭头,-->Setting-->SSH and GPG keys-->New SSH key-->将pub文件的全部内容填入key中,title可不填

命令行
ssh -T [email protected]
输入yes,完成初始化

git config --global user.email "[email protected]"
git config --global user.name "mygituser001"

=================以上配置阶段完成

命令行,不用https,因为https需要输入用户名和密码
git clone [email protected]:mygituser001/test.git

git add -A
git commit -m "20200419-1"
git push origin master


---------------------------------------
对于已经存在的文件夹,需要提交到git
首选要在github上创建一个仓库
在需要提交的文件夹内执行
echo *.mp4 .gitignore
git init
git remote add origin [email protected]:mygituser001/exist.git
#git fetch origin master:tmp
#git merge tmp
git pull origin master #pull操作会覆盖本地文件夹内的东西,如果远程已经有相同的东西,请使用上面的2行命令,执行到最后就删除临时分支 git branch -d tmp
git add -A
git commit -m "init 6 commit"
git push origin master

----------------------------
crontab 配置
#* * * * * /home/www/git/git_crontab.sh > /home/www/git/git.log 2>&1
echo `date +%Y%m%d%H%M%S` >> /home/www/git/test/modify.txt
echo "add" > /home/www/git/test/add.`date +%Y%m%d%H%M%S`
cd /home/www/git/test/
git add -A
git commit -m "`date +%Y%m%d%H%M%S`"
git push origin master

猜你喜欢

转载自www.cnblogs.com/ruanjianxian/p/12731300.html