git pull error: Not a directory
git error as follow:
$ git pull
From github.com:BubbleChang/somerepo
c4217267b..c2a93998a master -> origin/master
error: cannot update the ref 'refs/remotes/origin/bubble/49309': unable to append to '.git/logs/refs/remotes/origin/bubble/49309': Not a directory
! [new branch] bubble/49309 -> origin/bubble/49309 (unable to update local ref)
error: cannot update the ref 'refs/remotes/origin/bubble/50071': unable to append to '.git/logs/refs/remotes/origin/bubble/50071': Not a directory
! [new branch] bubble/50071 -> origin/bubble/50071 (unable to update local ref)
git pull would succeed when I command the following instead.
$ git pull origin master
But it isn’t very pleasant whenever you wanna sync up your branches.
Reference from this, you cannot have multiple branches, whose names from the beginning up to any slash (or to the end), differ only in upper and lower case.
- Check your branch names which are related to the error ones.
$ git ls-remote --heads | grep 'Bubble\|bubble'
From git@github.com:BubbleChang/somerepo
8be6fecd15573ed9b066b3d623669dd5ee40ad42 refs/heads/Bubble/12345
fb37c9976208eb7b2a7590b06d2f2a054e603adf refs/heads/bubble/49309
61a6066f623f6c878e88d9a004954d466e722113 refs/heads/bubble/50071
2. Remove the problematic branch.
$ git branch -d Bubble/12345
^^^ delete the branch
$ git push -d origin Bubble/12345
^^^ delete the branch remotely
3. Prune origin
$ git remote prune origin
Pruning origin
URL: git@github.com:BubbleChang/somerepo
* [pruned] origin/Bubble/12345
4. Clear .git/refs
$ rm -rf .git/refs/remotes/origin/*
Reference from the followings:
https://stackoverflow.com/questions/54229866/bitbucket-why-cant-i-create-a-master-x-branch
https://stackoverflow.com/questions/10068640/git-error-on-git-pull-unable-to-update-local-ref
https://stackoverflow.com/questions/60848682/cannot-update-the-ref-not-a-directory