通常代码版本控制的步骤是:

  • 在代码版本控制平台新建一个仓库
  • clone远程仓库到本地
  • 开始编码,然后是一系列add,commit,push

我的步骤是:

  • 在远程代码版本管理平台新建一个仓库
  • 在本地新建一个项目
  • 通过git remote add添加远程仓库
  • 然后add, commit, push

    但是commit时就报错了:
error: failed to push some refs to ....
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.

这说明此时两个仓库并没有建立关联,两个仓库的代码没有同步。

按照提示使用git pull拉取远程代码并合并又出现如下错误:

 refusing to merge unrelated histories

意思是两个仓库的历史记录不相关。

最终解决方案:

允许不相关的历史:

git pull origin master --allow-unrelated-histories

然后再push.

记一次Git提交报错的问题的更多相关文章

  1. git提交报错SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

    git push报错 git push origin master Administrator@FREESKYC-92DB80 /e/git/ouyida3/ouyida3.github.io (ma ...

  2. git 提交报错 : The file will have its original line endings in your working directory.

    报错现象 git  add . 的时候发现此报错 报错分析 看情况应该是不同系统对换行的识别不到位导致的 就常识来说文件是在windows下生成的所以换行和 linux 确实不同可能是因为这个导致的 ...

  3. git提交报错:Updates were rejected because the tip of your current branch is behind

    提交代码push时报错:上网查询了一下解决办法有很多种,1.使用强制push的方法:(上网查询说这种会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候.) git push -u origin ...

  4. git提交报错

    Error occurred computing Git commit diffsMissing unknown 0000000000000000000000000000000000000000 co ...

  5. ionic3 git 提交报错

    npm ERR! cordova-plugin-camera@ gen-docs: `jsdoc2md --template "jsdoc2md/TEMPLATE.md" &quo ...

  6. git提交报错:Error merging: refusing to merge unrelated histories

    执行: git pull origin master --allow-unrelated-histories 然后再重新push即可

  7. 【Git】git rebase报错new blank line at EOF.处理

    执行git rebase报错如下: First, rewinding head to replay your work on top of it... Applying: 本次提交信息 .git/re ...

  8. git push报错大文件,删除后重新commit依然报错

    git push报错: github不能上传大文件,按道理删掉重新提交就行了 可是删掉后,git add -A,再git commit,再git push,依然报错 后来我想明白了 github上传时 ...

  9. Git clone 报错 Unable to negotiate with xxx.xxx.xxx.xxx port 12345: no matching cipher found. Their offer: aes128-cbc,3des-cbc,blowfish-cbc

    git clone 报错 Unable to negotiate with xxx.xxx.xxx.xxx. port 12345: no matching cipher found. Their o ...

随机推荐

  1. MySQL数据库之主从复制

    一)MySQL主从复制的原理 MySQL主从复制是一个异步的复制过程,数据从一个MySQL数据库(master)复制到另一个MySQL数据库(slave),master和slave之间实现主从复制,主 ...

  2. 算法习题---3.11换抵挡装置(UVa1588)

    一:题目 给你连个长度分别为n1,n2且每列高度只为1或2的长条,然后将他们拼在一起,高度不能超过3,问他们拼在一起的最短长度 二:实现思路 1.获取主动轮和从动轮的数据. 2.主动轮不动,从动轮从左 ...

  3. 服务器(三):利用github的webhooks实现自动部署

    实现自动部署的关键就是利用github的webhooks,我们在github建立一个项目之后,在项目主页点击Settings,看到Webhooks点击打开可以添加一个链接,这里的意思是,github可 ...

  4. mysql数据format格式化错误

    DROP TABLE IF EXISTS `api_billing`; CREATE TABLE `api_billing` ( `id` ) NOT NULL AUTO_INCREMENT, `se ...

  5. javascript模拟生成uuid

    function guid() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r ...

  6. DB2中的NVL和NVL2函数

    NVL函数是一个空值转换函数 NVL(表达式1,表达式2) 如果表达式1为空值,NVL返回值为表达式2的值,否则返回表达式1的值. 该函数的目的是把一个空值(null)转换成一个实际的值.其表达式的值 ...

  7. 【Leetcode_easy】686. Repeated String Match

    problem 686. Repeated String Match solution1: 使用string类的find函数: class Solution { public: int repeate ...

  8. OC入门笔记

    1OC概述OC主要负责UI界面:C语言和C++可以用于图形处理.OC是一门面向对象的语言.C语言是面向过程的.比C++简单很多以C语言为基础,完全兼容C语言.OC语言中的所有事物都是对象,都有isa指 ...

  9. sql-获取重复和删除重复数据

    //获取相同用户名的数据 //删除相同的数据,保留最大的id或者最小的id min(id) delete from user where id not in(select max(id) from u ...

  10. AWS 核心服务概述(二)

    目录 AWS网络服务 VPC Direct Connect Route53 AWS 计算服务 EC2 EMR(Elastic MapReduce) AWS Lambda Auto Scaling El ...