Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: The following untracked working tree files would be overwritten by merge: upload/.DS_Store

Tags:

git

I'm a git newbie and am having an annoying error. I've spent a few hours going through different posts on StackOverflow to see how other users solved this, but nothing is working for me.

When pulling from the repo, I get the following error:

error: The following untracked working tree files would be overwritten by merge: upload/.DS_Store

  • I deleted .DS_Store from my Mac, but it just recreated the file.
  • I tried git add ., git stash, git pull and still got the error.
  • I added .DS_Store to .gitignore, but I still get the error.

I have no idea what to do.

like image 681
steeped Avatar asked Oct 15 '15 15:10

steeped


1 Answers

Somebody has added the file already and pushed in the changes you are trying to merge during pull. In most cases it is a mistake.

If you have write access to the repository, remove the file as soon as possible from there. Then merging should succeed.

How to remove them: Github allows to remove files this from web interface, for example. If you cannot do it from web, clone the master branch, call git rm on the file, commit and push. Even if they are auto created, repository will remember them as removed.

Make sure you do no add them again (add the filename to .gitignore)

like image 167
max630 Avatar answered Oct 09 '22 18:10

max630