Error when running git pull origin master

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.


You could use first

git clean -f -d

(or git reset --hard HEAD ) to clean your untracked files then do a

git pull

Keep in mind this will delete any untracked files


What you need to do is remove the local untracked copy. What's happening is that a file exists remotely, but not locally. git will not allow you to overwrite a local untracked file.

you have to use ctrl+shift+F10 its useful

链接地址: http://www.djcxy.com/p/45028.html

上一篇: 你如何获得Git合并来忽略选定文件中的冲突?

下一篇: 运行git pull origin master时出错