问题类型

相信很多小伙伴在创建新的git仓库后,会选上添加README.md文件,开始我也没太在意,应该也没有什么问题。

但是当我通过git添加远程仓库,给这个仓库上传代码时,出现了如下问题:error: The following untracked working tree files would be overwritten by merge:README.md

$ git pull origin master
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 12 (delta 2), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (12/12), done.
From github.com:Ryxiong/Python-review
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
error: The following untracked working tree files would be overwritten by merge:
README.md
Please move or remove them before you merge.
Aborting

问题分析

出现这个问题,其实很简单,就是因为我们在本地的仓库中,也写了自己的README.md文件,在上传的时候与远程的冲突了,这时候就会抛出这个错误,

解决方法

这里看我们需要哪一个README.md,如果我们需要保留远程的README.md,那我们需要删除本地的。

1.删除本地的README.md文件

2.拉取远程的README.md文件到本地

git pull origin master

3.进行正常的提交代码

git add .
git commit -m "备注"
git push origin master

如果我们需要保留本地的,那么需要先把本地的移动到另一个地方

1.拉取远程的README.md到本地仓库

git pull origin master

2.将之前备份的本地README.md内容更新到拉取的README.md中

3.进行正常的代码提交

git add .
git commit -m "备注"
git push origin master

错误 error: The following untracked working tree files would be overwritten by merge:README.md的更多相关文章

  1. Git错误:error: The following untracked working tree files would be overwritten by merge:

    [andy@localhost weixin_robot]$ git pull Updating d652d1c..fa05549 error: The following untracked wor ...

  2. git pull 错误:The following untracked working tree files would be overwritten by merge

    错误描述: $ git pull origin alphaFrom https://github.com/shirley-wu/HeartTrace * branch            alpha ...

  3. Error pulling origin: error: The following untracked working tree files would be overwritten by...

    git在pull时,出现这样的错误的时候,可能非常多人进进行stash.相关stash的请看:Error pulling origin: error: Your local changes to th ...

  4. git checkout 提示 “error: The following untracked working tree files would be overwritten by checkout” 解决

    问题描述 Windows 或者 macOS 操作系统中,文件名是不区分大小写的.对于已经提交到仓库中的文件修改文件名的大小写,然后又用 git rm 命令将老文件从 Git 仓库删除掉,并保存下新的文 ...

  5. git解决error: The following untracked working tree files would be overwritten by checkout

    在IDEA中进行分支切换时,出现如此错误,导致无法正常切换:error: The following untracked working tree files would be overwritten ...

  6. The following untracked working tree files would be overwritten by merge

    git pull的时候遇到这样的问题: The following untracked working tree files would be overwritten by merge balabal ...

  7. git更新代码报错,error: The following untracked working tree files would be overwritten by ch

    git忽略大小写导致的, git config --add core.ignorecase true

  8. git clean解决 GIT error: The following untracked working tree files would be overwritten

    git clean用法:https://www.cnblogs.com/lsgxeva/p/8540476.html :

  9. Some untracked working tree files would be overwritten by checkout. Please move or remove them before you can checkout. View them

    Some untracked working tree files would be overwritten by checkout. Please move or remove them befor ...

随机推荐

  1. Android remote gdb

    On Android phone adb push ~/utils/android-ndk-r12b/prebuilt/android-arm64/gdbserver/gdbserver /data/ ...

  2. 简述COOKIE和SESSION的区别与联系?

    cookie 和session 的区别:1.cookie数据存放在客户的浏览器上,session数据放在服务器上.2.cookie不是很安全,别人可以分析存放在本地的COOKIE并进行COOKIE欺骗 ...

  3. PY 个板子计划【雾

    各类板子计划 A+B √ 放个鬼的链接[雾 欧拉筛 √ https://www.cnblogs.com/Judge/p/11690114.html 树状数组 √ 惨痛的教训,以后咱打数据结构的时候绝对 ...

  4. 4-2如何判断字符串a是否以字符串b开头或结尾

    1.相关介绍 1.1修改文件权限和查看文件权限 在windows平台实验时 os.chmod()无法将文件权限修改为可执行,暂不深究如何实现.在linux平台进行测试. (1)创建三个文件 pytho ...

  5. 关于“如何只用2GB内存从20亿,40亿,80亿个整数中找到出现次数最多的数?”的一种思路

    小弟不才,只懂一些c#的皮毛,有一些想法, int32值范围大概在-20亿——20亿,按hashtable一个keyvalue占8B的设定来说,最大可以存储大约2.5亿个 数字-次数对. 那么,可以将 ...

  6. IOS绘图详解(http://blog.163.com/wkyuyang_001/blog/static/10802122820133190545227/)

    14.1 Quartz概述 Quartz是Mac OS X的Darwin核心之上的绘图层,有时候也认为是CoreGraphics.共有两种部分组成Quartz: Quartz Compositor,合 ...

  7. debian利用snmp监控服务器异常状态

    1.安装snmp apt-get install snmp snmpd 2.配置snmp vi /etc/snmp/snmpd.conf 注释15行 #agentAddress udp:127.0.0 ...

  8. STM32内核简介

    STM32F407 的内核是cortex-M4   采用的是ARM架构,具体是ARM-V7架构. 而ARM-V7架构分为三个系列: 1>.A系列:面向尖端的基于虚拟内存的操作系统和用户应用: 2 ...

  9. Effective C++条款05:了解C++默默编写并调用哪些函数

    class Empty{}; class Empty{ Empty(){}; Empty(const Empty& rhs){}; ~Empty(){}; Empty& operato ...

  10. MyEclipse XML & XML架构教程:XML Schema (XSD)编辑器

    [MyEclipse CI 2019.4.0安装包下载] 1. MyEclipse中的XSD编辑 本文档介绍MyEclipse XML Schema(XSD)编辑器中的一些可用函数.XML Schem ...