I realize that this question has been asked several times already, but unfortunately none of the solutions under the older questions have been able to solve my issue. Essentially, I'm trying to pull from a remote repository and I'm getting an error each time saying:
error: cannot lock ref 'refs/remotes/origin/photonic_link': unable to resolve reference 'refs/remotes/origin/photonic_link': reference broken
From https://gitlab.com/GXC_Dev/genxcomm-python-library
! [new branch] photonic_link -> origin/photonic_link (unable to update local ref)
Now if it matters as far as solving the issue, I had to switch my branch from master to photonic_link a week ago because I pulled the wrong branch (master) without realizing I was supposed to be working on a different one. This is also the first time I've tried to pull from the repository since I switched branches.
As I mentioned earlier, I've tried the solutions in the other answers and none of them have worked for me. I've tried git gc --prune=now
and git gc
, but I got the following response for both of those commands:
error: bad ref for .git/logs/HEAD
error: bad ref for .git/logs/refs/heads/photonic_link
error: bad ref for .git/logs/refs/remotes/origin/photonic_link
fatal: bad object refs/heads/photonic_link
fatal: failed to run repack
Then I tried git rm -rf .git/logs/refs/remotes/origin/photonic_link
, and I received a fatal error:
fatal: pathspec '.git/logs/refs/remotes/origin/photonic_link' did not match any files
git rm -rf .git/refs/remotes/origin/photonic_link
returns a "did not match any files" error similar to the one above as well.
Running git fetch
returns the following:
remote: Enumerating objects: 215, done.
remote: Counting objects: 100% (215/215), done.
remote: Compressing objects: 100% (136/136), done.
remote: Total 215 (delta 119), reused 144 (delta 75)
Receiving objects: 100% (215/215), 69.08 KiB | 115.00 KiB/s, done.
Resolving deltas: 100% (119/119), completed with 8 local objects.
From https://gitlab.com/GXC_Dev/genxcomm-python-library
98878cb..cef33e7 RF_Link_Modeling -> origin/RF_Link_Modeling
256b31e..9b09944 bell_dev -> origin/bell_dev
9c5603e..6209abc master -> origin/master
error: cannot lock ref 'refs/remotes/origin/photonic_link': unable to resolve reference 'refs/remotes/origin/photonic_link': reference broken
! [new branch] photonic_link -> origin/photonic_link (unable to update local ref)
The last thing I tried was going in and manually deleting line containing photonic_link from my .git/packed-refs file, but it doesn't exist in there. Does anyone know how I can resolve this issue?
.git/refs/heads/photonic_link
exist? If so, what type of file or directory is it, and what permissions does it have? If it is a file, does it contain a valid SHA-1?.git/refs/heads/photonic_link
does exist as a file, it has all permissions for SYSTEM except special permissions, and it's empty as far as I can tell..git/refs/remotes/origin/photonic_link
exists, and if so, what's wrong with it.