$ 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冲突导致的

有如下几种解决方法:

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]

转载于:https://www.cnblogs.com/hab-/p/7057802.html

git push本地代码到github出错相关推荐

  1. push本地代码到github出错

    $ git push -u origin master To git@github.com:**/Demo.git ! [rejected] master -> master (non-fast ...

  2. git push origin master时出错无法上传及github学习使用时遇到的其他一些问题错误

    我是根据https://blog.csdn.net/qq_41782425/article/details/85183250 这篇文章学习使用github的,非常详细,感谢前人,但是是2018年12月 ...

  3. 首次push本地代码到github上出现的问题及解决方案

    刚创建的github版本库,在push代码时出错: $ git push -u origin master To git@github.com:******/Demo.git  ! [rejected ...

  4. Git提交本地代码到GitHub

    提交代码到GitHub的基本流程: 1. 在GitHub上新建一个仓库. 2.找到项目所在文件夹,右键Git bash Here. 3. $ git init 4. $ git add .  (添加所 ...

  5. Ubuntu使用git更新本地代码到github

    一.打开github官网GitHub: Where the world builds software · GitHub登录自己的账号 二.点击左侧"Create repository&qu ...

  6. Git push file exceed GitHub's file size

    git-lfs下载 https://git-lfs.github.com/ 参考 https://blog.csdn.net/Tyro_java/article/details/53440666

  7. 解决git clone与git push出现的若干问题:Failed to connect to github.com port 443: Timed out

    折腾了一天多的时间,终于可以进行正常的git push与git clone操作了,用这篇博客来解决一下陆续出现的问题. 文章目录 1. 连接github失败问题汇总:Failed to connect ...

  8. git push时提示:更新被拒绝,因为您当前分支的最新提交落后于其对应的远程分支

    在对本地库中的文件执行修改后,想git push推送到远程库中,结果在git push的时候提示出错: ! [rejected]        master -> master (non-fas ...

  9. 解决git添加远程仓库提示出错信息:fatal: remote origin already exists

    解决git添加远程仓库提示出错信息:fatal: remote origin already exists. 解决办法如下:1.先输入$ git remote rm origin2.再输入$ git ...

最新文章

  1. bae 3.0 mysql_bae3.0 mysql 有时报错?报错-问答-阿里云开发者社区-阿里云
  2. 一个关于重定向的问题研究,应该具有实用性
  3. 使用Jedit建立IDE图文教程
  4. BZOJ 1683.City skyline 城市地平线
  5. js中字符串编码函数escape()、encodeURI()、encodeURIComponent()区别详解
  6. WIN7 远程桌面发生身份验证错误,要求的函数不受支持
  7. ShardingSphere(一)ShardingSphere简单介绍及相关概念
  8. 【codevs3304】水果姐逛水果店Ⅰ,线段树练习
  9. 阿里2000亿,腾讯5000亿,我们究竟需要多少数据中心?
  10. 浮点数比较大小的时候不能直接用等号
  11. spring学习--AOP五个通知
  12. 打开eclipse翻译错误值13 的解决办法
  13. 运维简历怎么写项目描述_简历中的项目描述
  14. Codeforces Round #490 (Div. 3) C. Alphabetic Removals
  15. SPIR-V 研究:编译器基本原理(三) - Chomsky文法分类
  16. ThinkBook 14 G2 ITL 重装系统 笔记
  17. android 铃音制作工具,来电铃声大全制作软件
  18. redis服务之主从复制、哨兵模式、群集模式
  19. Rich Dad Poor Dad
  20. 校园招聘可以报考哪些岗位?

热门文章

  1. kotlin 循环_Kotlin控制流–否则,用于循环,同时,范围
  2. WM5/6常见进程列表
  3. pythoon介绍、安装环境、基础知识、练习题
  4. Windows Server入门系列25 系统内置用户和组
  5. Android EditText的常用技巧
  6. Mac下查看Git的安装目录
  7. nagios 163邮件报警
  8. [转]六种删除数据库重复行的方法
  9. Nginx location
  10. Mathtype 免安装 | office自带UnicodeMath和LaTeX编辑功能