附载码云的使用教程地址:http://www.jianshu.com/p/084e0aabbab3

问题一:执行Git remote add origin https://github.com/XXXXXXX/gif.git

fatal: remote origin already exists.

出现此问题时,git remote显示所有的远程库,使用命令git remote rm origin删除该origin。

问题二: git push -u origin master推送本地库到github
                 fatal: I don't handle protocol 'git@https'

出现此问题时,使用命令git remote add origin http://github.com/XXXXXXX/gif.git 。

问题三:执行$ git push -u origin master
                 Username for 'https://github.com/XXXXXXX/gif.git'
                                     ! [rejected]        master -> master (fetch first)
                                    error: failed to push some refs to 'https://github.com/XXXXXXX/gif.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.

错误的主要原因是git仓库上已经存在readme文件,故在提交时可能会存在冲突,这时您需要选择的是保留线上的文件或者舍弃线上的文件,如果您舍弃线上的           文 件,则在推送时选择强制推送,强制推送需要执行下面的命令

git push origin master -f

如果您选择保留线上的readme文件,则需要先执行

git pull origin master

Git使用步骤:

在GitHub上新建一个abc仓库。

在本地新建Git仓库:

1、mkdir abc

2、cd abc

3、git init

4、将文件添加进去(file)

5、git add file1 file2 file...

6、git commit -m "add files"

7、git remote add origin https://git.oschina.net/xxx/abc.git

8、git push -u origin master

在这里,出现了错误提示:

error: failed to push some refs to 'https://git.oschina.net/xxx/abc.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.

这里提示推送失败,因为在GitHub上初始化了一个README.MD文件,远程仓库中的文件比本地的要新,所以要使用git pull要把最新的文件抓下来,与本地的文件合并之后在提交。

9、git pull

提示错误:

remote: Counting objects: 5, done.

remote: Compressing objects: 100% (2/2), done.

remote: Total 3 (delta 0), reused 3 (delta 0)

Unpacking objects: 100% (3/3), done.

From github.com:michaelliao/learngit

fc38031..291bea8  dev        -> origin/master

There is no tracking information for the current branch.

Please specify which branch you want to merge with.

See git-pull(1) for details

git pull <remote> <branch>

原因是没有指定本地master和远程origin/master的连接。

10、设置连接

$ git branch --set-upstream master origin/master

11、git pull

12、然后提交

git commit -m "merge README.MD"

13、git push -u origin master

完成本地上传远程仓库

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

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

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

  2. 解决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:/ ...

  3. 【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 ...

  4. 解决 error: failed to push some refs to ‘https://github.com/mxp520/test-spring-cloud-base.git‘

    在使用git对源代码进行push的到github时,可能会出现错误,如下图所示 出现错误的主要原因是github中的README.md文件不在本地代码目录中 可以通过如下命令进行代码合并[注:pull ...

  5. error: failed to push some refs to ‘https://github.com/bodokaiser/piwise.git‘

    problem: solution: git pull --rebase origin master

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

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

  7. 解决办法:error: failed to push some refs to 'https://github.com/xxxx.git'

    在github远程创建仓库后, 利用gitbash进行提交本地文件的时候出现如下错误: [root@foundation38 demo]# git push -u origin master User ...

  8. Git Bash中出现:error: failed to push some refs to ‘https://gitee.com/xxx/xxx.git‘错误的解决方法

    Git Bash中出现:error: failed to push some refs to 'https://gitee.com/xxx/xxx.git'错误的解决方法 今天上传本地文件,在输入:$ ...

  9. 完美解决: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 ...

最新文章

  1. 【面向对象编程】(3) 类之间的交互,依赖关系,关联关系
  2. 跨越企业的“中等收入陷阱”
  3. JS最流行Rust最受喜爱Clojure最赚钱,PHP:那我走?|2021年全球开发者报告
  4. 防止sql注入攻击的方法总结
  5. Vue中的基础过渡动画原理解析
  6. ITK:复制过滤器filter
  7. 图论--拓扑排序--判断是否为DAG图
  8. Flsak爱家租房--实名认证
  9. python读取坐标文本文件_使用python读取txt坐标文件生成挖空矿山_探矿批量
  10. Android动画学习笔记
  11. RabbitMQ常用交换机模式总结
  12. 优秀的WMS仓库管理系统应该具备哪些条件
  13. Linux 命令 | 常用命令 tree
  14. MTK手机官方ROM提取教程
  15. 建设工程施工合同系列一建工合同的范围(未完待续)
  16. 淘宝logo设计遇到的坑
  17. Golang多线程文件传输
  18. 转载一篇过来人谈的大学期间关于课外学习的意见lt;出自左飞老师笔记gt;
  19. presentation视频录制与编辑
  20. ocv特性_锂离子电池的三大特性分析

热门文章

  1. python取出一组数中的奇偶数
  2. P106双N卡 自动调用方案
  3. 什么是CAS和AQS
  4. fastqc检验时不能执行java_fastqc对原始测序reads质控
  5. 痛失PC霸主的联想,刘军将迎来艰难之战
  6. 看完数学概念背后的故事,让孩子的数学兴趣激增1000倍!
  7. C1128 和C4503
  8. Linux上wifi找不到网络的解决
  9. 《大数据时代》读书总结
  10. java登陆注册 mysql_Java+mysql用户注册登录功能