Can't do a git pull

I'm trying to do a git pull and get the error message:

error: The following untracked working tree files would be overwritten by merge:
<myFileName>
Please move or remove them before you can merge.

So, I try to remove the file using the command git rm --cache which results in the error:

fatal: pathspec
<myFileName>
did not match any files

At this point I'm stuck. I can't pull until I remove the file. But, it tells me I can't remove the file.

What can I do to fix this?


This is an opportunity for the 'git clean' command. If you don't care about the untracked files ... git clean -n to see what will be removed, and git clean -f to go ahead and rm untracked files.

Add -d to the commands to also operate on directories:

  git clean -dn
  git clean -df

You have untracked files in the way of the pull. You can't remove them with git rm --cached because they are untracked. They don't appear in the index. You need to remove them with plain old rm