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/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'相关推荐
- git 提交时报错 error: failed to push some refs to ‘https://github.com/xxx/demo.git 解决方法
1. 前言 本文解决由于git 处于游离状态下不能提交代码的问题.文章由导致原因,解决方法和思考三个内容组成. 2. 问题复现 我们从远程仓库 clone 代码下来,进行需求开发,可能进行了以下步骤. ...
- 解决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:/ ...
- 【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 ...
- 解决 error: failed to push some refs to ‘https://github.com/mxp520/test-spring-cloud-base.git‘
在使用git对源代码进行push的到github时,可能会出现错误,如下图所示 出现错误的主要原因是github中的README.md文件不在本地代码目录中 可以通过如下命令进行代码合并[注:pull ...
- error: failed to push some refs to ‘https://github.com/bodokaiser/piwise.git‘
problem: solution: git pull --rebase origin master
- 解决办法:git错误 error: failed to push some refs to 'https://github.com/...
问题描述: 今天在git bash中键入 $ git push origin master 进行提交的时候出现出现了 如下错误: ! [rejected] master -> master (n ...
- 解决办法:error: failed to push some refs to 'https://github.com/xxxx.git'
在github远程创建仓库后, 利用gitbash进行提交本地文件的时候出现如下错误: [root@foundation38 demo]# git push -u origin master User ...
- 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'错误的解决方法 今天上传本地文件,在输入:$ ...
- 完美解决: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 ...
最新文章
- 【面向对象编程】(3) 类之间的交互,依赖关系,关联关系
- 跨越企业的“中等收入陷阱”
- JS最流行Rust最受喜爱Clojure最赚钱,PHP:那我走?|2021年全球开发者报告
- 防止sql注入攻击的方法总结
- Vue中的基础过渡动画原理解析
- ITK:复制过滤器filter
- 图论--拓扑排序--判断是否为DAG图
- Flsak爱家租房--实名认证
- python读取坐标文本文件_使用python读取txt坐标文件生成挖空矿山_探矿批量
- Android动画学习笔记
- RabbitMQ常用交换机模式总结
- 优秀的WMS仓库管理系统应该具备哪些条件
- Linux 命令 | 常用命令 tree
- MTK手机官方ROM提取教程
- 建设工程施工合同系列一建工合同的范围(未完待续)
- 淘宝logo设计遇到的坑
- Golang多线程文件传输
- 转载一篇过来人谈的大学期间关于课外学习的意见lt;出自左飞老师笔记gt;
- presentation视频录制与编辑
- ocv特性_锂离子电池的三大特性分析