git pull and reset stopped by error “unable to create file <filename> (File exists)”

早过忘川 提交于 2019-12-10 10:37:41

问题


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!


回答1:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!