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

使用github问题

时间:2018-06-28 21:36:54      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:use   with   fir   res   git pull   tail   first   empty   create   

在github上面创建完仓库,推送代码的时候,出错了,报错如下:

.           

 

网上搜索了下,是因为远程repository和我本地的repositor技术分享图片

 

y冲突导致的,而我在创建版本库后,在github的版本库页面点击了创建README.md文件的按钮创建了说明文档,但是却没有pull到本地。这样就产生了版本冲突的问题。

有如下几种解决方法:

1.使用强制push的方法:

$ git push -uorigin master -f

这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候。

2.push前先将远程repository修改pull下来

$ git pull--rebase  origin master

$ git push -uorigin master

3.若不想merge远程和本地修改,可以先创建新的分支:

$ git branch[name]

然后push

$ git push -uorigin [name]

我采用的第二种方式,先pull到本地放自己本地的代码和github上面一样,然后,再push代码到github。

 

技术分享图片

 

 

 

Cause

This is caused by the repository still being empty. There are no commits in the repository and thus no master branch to push to the server.

Resolution

Create the first commit inside of the repository and then it can be pushed. For example, the following with create an initial commit and push it to the server.

touch initial
 
git add initial
 
git commit -m "initial commit"
 
git push -u origin master

github上传教程:https://blog.csdn.net/chenyufeng1991/article/details/48930471

使用github问题

标签:use   with   fir   res   git pull   tail   first   empty   create   

原文地址:https://www.cnblogs.com/threestoneslee/p/9240698.html

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