码迷,mamicode.com
首页 > 其他好文 > 详细

github用于备份

时间:2020-04-19 15:00:28      阅读:88      评论:0      收藏:0      [点我收藏+]

标签:%s   config   提交   临时   mod   comm   ===   tmp   pull   

github用户名 mygituser001
github用户邮箱 myemailuser001@gmail.com.com

命令行生成
ssh-keygen -t rsa -b 4096 -C "myemailuser001@gmail.com.com"
打开生成的pub文件
内容类似
ssh-rsa AAAAB3**************w== myemailuser001@gmail.com.com

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

命令行
ssh -T git@github.com
输入yes,完成初始化

git config --global user.email "myemailuser001@gmail.com.com"
git config --global user.name "mygituser001"

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

命令行,不用https,因为https需要输入用户名和密码
git clone git@github.com: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 git@github.com: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

github用于备份

标签:%s   config   提交   临时   mod   comm   ===   tmp   pull   

原文地址:https://www.cnblogs.com/ruanjianxian/p/12731300.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!