1

I am not sure what this person keeps doing, but I keep getting into situations where my git pull (on master) fails like so

(base) Deans-MacBook-Pro:webpieces dean$ git pull
error: cannot update the ref 'refs/remotes/origin/victor/Delete_List_Copy': unable to append to '.git/logs/refs/remotes/origin/victor/Delete_List_Copy': Not a directory
From github.com:deanhiller/webpieces
 ! [new branch]          victor/Delete_List_Copy -> origin/victor/Delete_List_Copy  (unable to update local ref)

I run these commands which run just fine

  • git clone git@github.com:deanhiller/webpieces.git webpieces3
  • git checkout victor/Delete_List_Copy

I am not sure what he does exactly but eventually my git repo has this directory which I keep deleting (and which does not exist via git branch -r neither) ->

.git/refs/remotes/origin/victor/

I then run

  1. rmdir .git/refs/remotes/origin/victor/
  2. git pull

git pull fails with the first error in this SO post. The victor directory is back with a vengeance and I have no idea why.

Next, I try git remote prune origin

This does not help as git pull results in same error.

Over time, each repo seems to become corrupt on just git pull. I have no idea why this is occurring nor how to fix this repo resulting in yet another git clone to start over :(

Dean Hiller
  • 19,235
  • 25
  • 129
  • 212
  • What if you *don't* delete this directory? – mkrieger1 Aug 29 '21 at 21:43
  • Have you tried `git pull --rebase`? I don't think the repo is corrupted, rather an issue with different versions of git. It could be related to https://stackoverflow.com/a/24114760/15515525 – DeMO Aug 29 '21 at 22:04
  • The golden rule is that you don't mess with stuff inside `.git` by hand unless you know what you are doing. Why do you manually delete that directory? – eftshift0 Aug 29 '21 at 22:30

1 Answers1

1

Your remote is behaving as if "victor" is serially making and deleting branches named victor and victor/whatever. Say git pull -p to get the fetch it runs to delete any stale refs first, that should prevent this kind of mismatch.

jthill
  • 55,082
  • 5
  • 77
  • 137
  • 1
    Based on the prompt, Dean Hiller is using a Mac, probably with the default case-insensitive file system. I'll bet whoever controls the upstream repository has created one branch named `Victor` and one named `victor/Thing`, or perhaps `victor` and `Victor/thing`, and is using Linux or similar and hence has case-sensitive branch behavior. – torek Aug 30 '21 at 08:52
  • 1
    I think it's Dean Hiller who controls the upstream repository, and he's manage to shoot himself in the foot because the upstream repo is on GitHub. :-) – torek Aug 30 '21 at 08:53
  • 1
    @torek haha well, it can't be both. Perhaps there's somebody named victor with push rights doing the case-sensitive branches you describe? – jthill Aug 30 '21 at 12:05
  • 1
    Yes—or, given that it's a fork, perhaps the original repo had them all along? – torek Aug 30 '21 at 13:44
  • @torek Yah. Regardless, I think you've got it, I didn't catch the import of the prompt (and OP never showed a capitalized Victor branch). Add that as an answer why don't you? Pretty sure it's the answer. – jthill Aug 30 '21 at 15:12