运行git pull origin master时出错 [英] Error when running git pull origin master

查看:109
本文介绍了运行git pull origin master时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用git版本控制的新手,运行git pull origin master 时出现此错误,这是错误:

 从/ opt / mygit / abc 
*分支主机 - > FETCH_HEAD
错误:未经合并的工作树文件'nbproject / private / rake-d.txt'将被合并覆盖。正在中止

我错过了什么吗?提前致谢。 :D

解决方案

看起来您的文件 nbproject / private / rake-d.txt 在你的本地存储库中,但不能被git跟踪。



同时,自上次拉出后,它已被添加到远程存储库中,拉将会覆​​盖该文件,因此git会警告您会发生这种情况并中止拉。



要解决此问题,您需要去删除或重新命名文件。



如果您想自动执行此操作,请运行 git clean 以清除文件夹未跟踪的文件(即删除它们)。首先运行 git clean -n 可能是一个好主意,但它仅仅列出它将要删除的文件,让你看看它打算删除的任何重要内容。

或者,您可以将文件添加到存储库(记住提交它),然后拉取。然后git会尝试合并你的本地副本和远程副本。


I'm a newbie in using git version control, I got this error when running git pull origin master, this is the error :

From /opt/mygit/abc
 * branch            master     -> FETCH_HEAD
error: Untracked working tree file 'nbproject/private/rake-d.txt' would be overwritten by merge.  Aborting

Am I miss something? thanks in advance. :D

解决方案

It would appear that you have the file nbproject/private/rake-d.txt in your local repository, but not tracked by git.

Meanwhile, it has been added to the remote repository since your last pull, so doing a pull would overwrite that file, and thus git is warning you that that would happen and aborting the pull.

To resolve this, you'll need to go and either delete or rename the file.

If you want to automate this, run a git clean to clean out the folder of untracked files (that is, delete them). It might be a good idea to run git clean -n first, though, which merely lists the files it's going to delete, letting you see if there's anything important it plans on deleting.

Alternatively, you could add the file to the repository (remember to commit it), and then pull. git will then try to merge your local copy with the remote one.

这篇关于运行git pull origin master时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆