2

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!

Community
  • 1
  • 1
John K
  • 147
  • 2
  • 11
  • Instead of `git pull`, I recommend using `git fetch`. This will update your remote pointer branch (e.g. `origin/master`) but won't touch your local branch (e.g. `master`). You can then compare `master` with `origin/master`, see what the differences are, and do a proper merge. This will have the same end result as `git pull`, but IMO you get more control. – ChrisGPT was on strike Jun 27 '14 at 15:54

1 Answers1

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.

Community
  • 1
  • 1
John K
  • 147
  • 2
  • 11