关于git的一些操作

今天上传github时遇到了不少的小问题

1.上传了新内容,新内容多了个文件想要删除

执行如下命令:

2.删除后,要上传github更新,遇到了如下问题

$ git push -u origin master
To https://github.com/biyeee/ZL_spider.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/biyeee/ZL_spider.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

百度了一下,是因为我在第一次上传时没有创建README.me文件,而在github上创建了,导致github与本地仓库不同步无法上传

解决办法:

1.git pull 先把github上的文件取回本地

2. git commit -m '操作说明' 更新本地仓库

3.git push -u origin master 再执行上传代码

成功!!!

 

posted @ 2018-07-23 16:28  biyeee  阅读(149)  评论(0编辑  收藏  举报