I am currently moving my company to Git from Vault, and I've set up the repos on Github, but setting up locally is being made a headache by some reoccurring errors. The most baffling is that when I try to pull, it cancels with the error "error: unable to create file (File exists)" for a few files. I just want to set myself up with what is on the remote, so I try to do a git reset --hard HEAD, and it tells me that it succeeded and my working directory is clean. I try to pull again and get the same error! When I run git gc, it just restores my unstaged changes.
A look at the git diff and the current file system on Github reveals that these unstaged changes have already been applied on Github. I think Git is trying to apply changes that have already been applied and failing, but I still don't understand why this isn't fixed by a hard reset. Trying to reset to a further back commit also fails.
I have already read this and this and several other articles, but nothing suggested works. I would prefer not to delete the repo and re-clone, because I have a bunch of ignored program files in the directory that need to be accounted for. Thanks!
I found the problem is related to permissions. The repo is located in Program Files, and I think Git doesn't have the permissions to execute certain scripts on/in that folder. I have updated the question here.
来源:https://stackoverflow.com/questions/24455796/git-pull-and-reset-stopped-by-error-unable-to-create-file-filename-file-exis