git项目初次push提示error: failed to push some refs to https://gitee.com/xxxx/gittest.git’解决方案 --九五小庞
在本地与远程新建仓库并关联后,初次push可能会遇到以下问题
- $ git push -u origin master
- To https://gitee.com/xxxx/gittest.git
- ! [rejected] master -> master (fetch first)
- error: failed to push some refs to 'https://gitee.com/xxxx/gittest.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.
原因是因为远程仓库有一些文件而本地没有,通常是在远程建立仓库时有一些初始化文件比如Readme License 等,并且直接pull会提示warning: no common commits,对于此类问题可以采用两种解决办法
1.git push -f 强制将本地文件推送至远程,这样会将远程仓库的已有的文件清掉
2. git pull origin master –allow-unrelated-histories 使用此命令告诉 git 允许不相关历史合并 这样就能把远程文件拉取回来。执行此命令后会有一个提示,要求说明为何要讲两个不相关的分支合并,输入信息后保存即可。
拉取完不同的文件之后再执行git push -u origin master命令即可push成功。
建议使用第二种办法
- Merge branch 'master' of https://gitee.com/xxxx/gittest.git
- # Please enter a commit message to explain why this merge is necessary,
- # especially if it merges an updated upstream into a topic branch.
- #
- # Lines starting with '#' will be ignored, and an empty message aborts
- # the commit.
- Merge made by the 'recursive' strategy.
- .gitignore | 66 ++++++++++++
- LICENSE | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- README.en.md | 36 +++++++
- README.md | 37 +++++++
- 4 files changed, 478 insertions(+)
- create mode 100644 .gitignore
- create mode 100644 LICENSE
- create mode 100644 README.en.md
- create mode 100644 README.md
git项目初次push提示error: failed to push some refs to https://gitee.com/xxxx/gittest.git’解决方案 --九五小庞的更多相关文章
- vue 项目上传到码云,push时error: failed to push some refs to 'https://gitee.com/mawenrou/vue_ht.git'
vue 项目上传到码云,push时error: failed to push some refs to 'https://gitee.com/mawenrou/vue_ht.git' 因为之前已经创建 ...
- failed to push some refs to 'https://gitee.com/ftl_663/java-shop.git'
1.git init 2.git add . 3.git commit -m "init" 4.git remote add origin https://gitee.com/ ...
- Git本地分支版本号过低导致的push错误 error: failed to push some refs to ... 及兴许amend
今天在用git的时候遇到了一个问题.在想远程分支push的时候,出现了以下的错误: ! [remote rejected] master -> refs/for/master (change 1 ...
- 解决git push出现error: failed to push some refs to 错误
错误截图 背景 码云上创建了空项目 本地项目绑定了远程仓库,尝试git push,然后报了错 解决办法 使用强制命令git pull origin master --allow-unrelated-h ...
- git 错误error: failed to push some refs to
今天使用VSCODE 学习node.js, 想在git上push代码 于是在git上建立了一个私有的长裤, 连接后push代码时提示如下错误: error: failed to push some ...
- git push -u origin master error: failed to push some refs to
1.问题描述 $ git push -u origin master To github.com:[github_name]/[github_repository_name].git ! [rejec ...
- git 解决 error: failed to push some refs to 'https://github.com/xxxx.git'
在github远程创建仓库后, 利用gitbash进行提交本地文件的时候出现如下错误 [root@foundation38 demo]# git push -u origin master Usern ...
- 解决git仓库项目 添加到github非空仓库冲突问题 error: failed to push some refs to 'https://github.com/Qtoken/......'
error: failed to push some refs to 'https://github.com/Qtoken/......' 1. 问题描述:执行命令:git push origin m ...
- git push origin master出错:error: failed to push some refs to
1.输入git push origin master 出错:error: failed to push some refs to 那是因为本地没有update到最新版本的项目(git上有README. ...
- To ssh://xxx.com:8022/test/project.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'ssh://xxx.com:8022/test/project.git'
To ssh://xxx.com:8022/test/project.git ! [remote rejected] master -> master (pre-receive hook dec ...
随机推荐
- 遇到的问题之“Parameter 'item' not found. ”
一.问题 Parameter 'item' not found. 参数item找不到 二.原因 这里的值没有写对,#{item}的item应是改为productSku,改后就不会报错了 三.解决方案 ...
- Flask 中用 dbutils 实现数据库连接池
之前用 dbutils 来实现数据库连接池, 这里将其封装为一个自定义类并在 flask 中实际应用一下, 在实际场景中肯定是多页面接口, 这也就涉及到 python 的 import 问题, 就个人 ...
- net core mvc6使用jwt实现简单的登录
创建一个新的.NET Core Web应用程序项目.在创建项目时,选择MVC模板. 在项目中添加Microsoft.AspNetCore.Authentication.JwtBearer包: 在Vis ...
- ASP.NET Core已有数据库,却新建项目
ASP.NET Core已有数据库,却新建项目,只需要构造出相应的类,DbContext,然后直接add-migration init即可!!而不用执行update-database,执行后者会报错: ...
- wireshark的所有入门指令(总结与摘要)
wireshark的所有指令 常用捕获过滤器 1.基于IP地址进行捕获 host 10.3.1.1 dst host 10.3.1.1 net 192.168.1.0/24 net 192.168.1 ...
- 阅读类元服务开发笔记---week4
.markdown-body { line-height: 1.75; font-weight: 400; font-size: 16px; overflow-x: hidden; color: rg ...
- 阅读类元服务开发笔记---week3
.markdown-body { line-height: 1.75; font-weight: 400; font-size: 16px; overflow-x: hidden; color: rg ...
- OpenDeepWiki:让您的代码仓库拥有MCP变成Agents的一部分!!
想象一下,如果您的代码仓库突然有了生命,能够自己介绍自己.回答问题.甚至还能生成漂亮的文档,那会是什么样的场景?别以为这是科幻小说,OpenDeepWiki就是这样一个神奇的"代码翻译官&q ...
- RabbitMq使用中常见错误--python版
用python的pika库错误集 一.pika.exceptions.ProbableAuthenticationError: ConnectionClosedByBroker: (403) 'ACC ...
- 「Trick」智慧
技巧部分 离线可能会使询问.操作的配置变得不那么怪异,甚至具有某种性质,类似去掉了某一维度的限制. ACAM 尝试在 Trie 树上或者 fail 树上进行 DP.(这不是很显著吗啊喂!) 注意到一些 ...