转 push本地文件到GitHub出错
来源:互联网 发布:广州天拓网络待遇 编辑:程序博客网 时间:2024/06/07 01:52
刚创建的github版本库,在push代码时出错:
$ git push -u origin master
To git@github.com:******/Demo.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:******/Demo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
网上搜索了下,是因为远程repository和我本地的repository冲突导致的,而我在创建版本库后,在github的版本库页面点击了创建README.md文件的按钮创建了说明文档,但是却没有pull到本地。这样就产生了版本冲突的问题。
有如下几种解决方法:
1.使用强制push的方法:
$ git push -u origin master -f
这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候。
2.push前先将远程repository修改pull下来
$ git pull origin master
$ git push -u origin master
3.若不想merge远程和本地修改,可以先创建新的分支:
$ git branch [name]
然后push
$ git push -u origin [name]
$ git push -u origin master
To git@github.com:******/Demo.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:******/Demo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
网上搜索了下,是因为远程repository和我本地的repository冲突导致的,而我在创建版本库后,在github的版本库页面点击了创建README.md文件的按钮创建了说明文档,但是却没有pull到本地。这样就产生了版本冲突的问题。
有如下几种解决方法:
1.使用强制push的方法:
$ git push -u origin master -f
这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候。
2.push前先将远程repository修改pull下来
$ git pull origin master
$ git push -u origin master
3.若不想merge远程和本地修改,可以先创建新的分支:
$ git branch [name]
然后push
$ git push -u origin [name]
1 0
- 转 push本地文件到GitHub出错
- 上传本地文件到GitHub时出错
- push本地代码到github出错
- push本地代码到github出错
- Git push本地代码到github出错
- push本地代码到github出错
- push本地代码到github出错
- push本地代码到github出错
- push本地代码到github出错
- push本地代码到github出错
- push本地代码到github出错
- push本地代码到github出错
- push本地代码到github出错
- push本地代码到github出错
- 通过git把本地文件push到github上
- github提交push出错
- 上传本地文件到github
- 上传本地文件到github
- 世界十大顶尖家族的家训
- ceph存储 集群恢复流程详解
- python实现的某网页模拟点赞程序
- VLC相关播放旋转,翻转参数说明
- 1分钟通晓C语言的4种预定义符号
- 转 push本地文件到GitHub出错
- delphi actionlist
- Oracle11g的安装和基本使用
- 【去广告】
- 关于C++中的构造函数、拷贝构造函数、析构函数的总结
- wpf得到窗口或控件的句柄
- windows10 opengl配置
- 远程备份和恢复Oracle数据库PL/SQL
- Tcpdump抓包命令详解