在github远程创建仓库后, 利用gitbash进行提交本地文件的时候出现如下错误:

[root@foundation38 demo]# git push -u origin master
Username for 'https://github.com': xuefeilong
Password for 'https://xuefeilong@github.com':
To https://github.com/xuefeilong/test.git! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/xuefeilong/test.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.


解决办法:

1: 进行push前先将远程仓库pull到本地仓库
$ git pull origin master    #git pull --rebase origin master
$ git push -u origin master2: 强制push本地仓库到远程 (这种情况不会进行merge, 强制push后远程文件可能会丢失 不建议使用此方法)
$ git push -u origin master -f3: 避开解决冲突, 将本地文件暂时提交到远程新建的分支中
$ git branch [name]
# 创建完branch后, 再进行push
$ git push -u origin [name] 

我使用的是直接加入参数-f,但是不推荐比较粗暴:

[root@foundation38 demo]# git push -u origin master -f
Username for 'https://github.com': xuefeilong
Password for 'https://xuefeilong@github.com':
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (13/13), 975 bytes | 0 bytes/s, done.
Total 13 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/xuefeilong/test.git+ 5c057df...abfded5 master -> master (forced update)
Branch master set up to track remote branch master from origin.

解决办法:error: failed to push some refs to 'https://github.com/xxxx.git'相关推荐

  1. 完美解决:error: failed to push some refs to 'https://github.com/xxxx.git'

    完美解决:error: failed to push some refs to 'https://github.com/xxxx.git' 1.强制push本地仓库到远程 (这种情况不会进行merge ...

  2. 解决办法:git错误 error: failed to push some refs to 'https://github.com/...

    问题描述: 今天在git bash中键入 $ git push origin master 进行提交的时候出现出现了 如下错误: ! [rejected] master -> master (n ...

  3. 解决办法:git错误 error: failed to push some refs to ‘https://github.com/...

    问题描述:在git bash中键入 $ git push 进行提交的时候出现错误 error: failed to push some refs to 'https://github.com/blue ...

  4. 解决error: failed to push some refs to 'https://github.com/Dongyaxin-ai/learngit.git'

    问题 在git bash 中键入git push -u origin master 进行提交的时候出现 如下错误 error: failed to push some refs to 'https:/ ...

  5. git 提交时报错 error: failed to push some refs to ‘https://github.com/xxx/demo.git 解决方法

    1. 前言 本文解决由于git 处于游离状态下不能提交代码的问题.文章由导致原因,解决方法和思考三个内容组成. 2. 问题复现 我们从远程仓库 clone 代码下来,进行需求开发,可能进行了以下步骤. ...

  6. 【GIT】error: failed to push some refs to 'https://github.com/username/python.git'

    error: failed to push some refs to 'https://github.com/username/python.git' 解决error: failed to push ...

  7. it : Tmaster (hook declined) error: failed to push some refs to https://xxx/biluo/xxx.git

    To https:///biluo/xxx.git! [remote rejected] master -> master (hook declined) error: failed to pu ...

  8. Git提交数据失败 error: failed to push some refs to 'https://github.com/XXXXXXX/gif.git'

    附载码云的使用教程地址:http://www.jianshu.com/p/084e0aabbab3 问题一:执行Git remote add origin https://github.com/XXX ...

  9. 在github上传项目时error: failed to push some refs to 'https://github.com/...

    push时出现error: failed to push some refs to 'https://github.com/...这个错误. 出错原因主要是GitHub中README.md文件不在本地 ...

最新文章

  1. 机器学习(6)KNN算法(K-近邻算法)
  2. c#算两个火星坐标的距离(高德or百度)
  3. Imagemagick常用指令
  4. Jquery中使用ajax请求SSM后台时提示:org.springframework.http.converter.HttpMessageNotReadableException: Could no
  5. boost::gil::channel_view用法的测试程序
  6. [转]基于Starling移动项目开发准备工作
  7. ArcGIS实验教程——实验二十二:空间数据符号化
  8. java文件上传总结
  9. 永恒纪元服务器维护时间,永恒纪元各个阶段玩法攻略指南少走弯路
  10. 对10亿个数据去重java_JAVA 8 新特性
  11. string类有可以调换方向的函数吗_关于String类的split()方法
  12. 华为电脑c盘哪些文件可以删除,c盘可以删除哪些文件
  13. 运维小白linux基础知识总结
  14. SQL中的随机函数-笔记
  15. 喂,恶臭青年,你还想继续单身?今天特别福利来袭,出来挨打!
  16. FileNotFoundError: [WinError 3] 系统找不到指定的路径。
  17. ubuntu18.04美化主题(完整版)
  18. 中兴新支点安装broadcom博通wifi无线网卡驱动
  19. Excel应用技巧3 超级表格
  20. Leetcode刷题100天—706. 设计哈希映射(哈希表)—day74

热门文章

  1. python用matplotlib画皮卡丘_matplotlib常用用法总结(持续更新)
  2. java straem 过滤_Java Stream 过滤器
  3. CorelDRAW 发光字想制作的漂亮一些就得会这些技巧
  4. 文本增强、半监督学习,谁才是 NLP 少样本困境问题更优的解决方案?
  5. 计算机网络中核心部分,什么是计算机的核心部分
  6. 会计学python就业_会计专业出来后前景如何?
  7. telnet 正在连接127.0.0.1:9123...无法打开到主机的连接。 在端口 23: 连接失败
  8. java后端接收前端传来的String数组
  9. 【C语言】C语言数据类型
  10. 关于ArcGIS中选择属性值为空的语句