Git issues with VS 2019 cannot lock ref errors will not go away

Viewed 1777

I'm working with git and Vs 2019 now via Azure DevOps.

I am rarely use the command line for anything.

Anytime I'm trying to check-in to the remote branch I'm working on I keep seeing this error:

 = [up to date]      feature/App0       -> origin/feature/App0
cannot lock ref 'refs/remotes/origin/feature/App1': is at a3c22d80944c0ca5e8ef62b7de07c7e3c1ee35be but expected 3a9c5aad0cef53a97c2e6c12283710a8df3e9a6f
 ! 3a9c5aa..a3c22d8  feature/App1           -> origin/feature/App1  (unable to update local ref)
 = [up to date]      feature/App2      -> origin/feature/App2
   7b2ef4c..8075557  feature/App3 -> origin/feature/App3

I've tried this: Git and nasty "error: cannot lock existing info/refs fatal"

None of these branches are on my local computer though where the cannot lock ref error shows up.

Things I've tried:

  1. Deleting my entire /git folder structure and cloning all the necessary branches I need down
  2. These commands below. It seems to fix it for the moment where I can check in and Sync, but then will error out again:
       git gc --prune=now
       git remote prune origin
    
  3. I've tried this and again, it works the initial time after, but this eventually shows the error again
     1. Remove .git/logs/refs/remotes/origin/branch
     2. Remove .git/refs/remotes/origin/branch
     3. Run git gc --prune=now

What am I doing wrong??? No one else on my team seems to be having these issues.

Update:

Here is the latest error:

cannot lock ref 'refs/remotes/origin/feature/App1': is at 3d1cfe650be0d5df29d8cba118d78b0a9e267fd1 but expected 112fff939e24b01b6893ca07cba90f864562284c ! 112fff9..3d1cfe6 feature/App1-> origin/feature/App1(unable to update local ref)

So I go to the file path of: refs/remotes/origin/feature/App1 and the folder is: /origin/Feature/App1 I do not see /origin/feature/App1.

So if you go to DevOps and look at branches App is under feature/app1 but my computer has it under Feature/App1.

As stated before: I can run the 2 commands

  ```
     git gc --prune=now
     git remote prune origin
  ```

And it will fix it for the mean time and allow the Pull operation to work and not error out.

0 Answers
Related