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

  • 在代码版本控制平台新建一个仓库
  • 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. python模块之request模块的理解

    首先还是老生长谈,说说定义和作用,request模块是一个用于访问网络的模块,其实类似的模块还有很多,不在一一在这里解释.这么多的相似的模块为什么都说只有这个好用呢.因为他人性化.如果你学过urlli ...

  2. QDateTime QString

    QDateTime格式化  yyyy-MM-dd hh:mm:ss QString getFormatDateStr(QDateTime dateTimeParam) { qDebug() <& ...

  3. 阶段5 3.微服务项目【学成在线】_day18 用户授权_05-方法授权-方法授权测试

    这是我们课程的服务里面 加了授权的方法 重启课程管理的服务 首先需要登陆 在redis复制token 访问课程列表 用最新复制的令牌 最新token可以 调用teachplan方法 调用 一个没加注解 ...

  4. 教你如何在linux上装逼,shell中颜色的设置

    linux启动后环境变量加载的顺序为:etc/profile → /etc/profile.d/*.sh → ~/.bash_profile → ~/.bashrc → [/etc/bashrc] 想 ...

  5. Oracle ORA-00984: column not allowed here

    ORA-00984错误: 列在此处不允许当数据以char的形式存在时,应加单引号,则插入数据库就不会出现类似错误.

  6. (十七)super关键字(转)

    --本文摘自孤傲苍狼博客. 一.super关键字

  7. iOS通知注意点

    之前以为控制器发送通知,只有你满足:1>注册接收通知:2>进入本页面才能接收到值. 今天朋友问了一个问题: 他的逻辑如下: 退出登录发送通知,需要好几个界面会收到通知,然后这几个界面进行网 ...

  8. 使用json_encode编码中文返回null的解决方案

    在gbk的程序中,直接使用json_encode编码包含中文字符的数组,将会返回null. 解决方法: 1.把程序文件编码改为utf8 2.使用mb_convert_encoding把编码转换为utf ...

  9. 用MOQ来Mock静态方法的 2种方法(含Moq和Fakes的配合使用)

    Moq是无法直接模拟静态方法的,解决方式有两种: 1.需要修改正式代码,在源代码中建一个新的方法把静态方法包起来,调用的时候源代码调用时调用新方法而不是原来的静态方法. 在测试的时候,Mock掉这个新 ...

  10. docker安装并持久化postgresql数据库

    安装docker步骤略过 1.拉取postgresql镜像 docker pull postgresql 2.创建本地卷,数据卷可以在容器之间共享和重用, 默认会一直存在,即使容器被删除(docker ...