2

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.

ttaylor27272727
  • 195
  • 3
  • 18
  • 1
    By chance are there multiple branches with the same name but different case? – Matt Sep 01 '20 at 20:59
  • @Matt There could be. What would the issue be with this if there are? – ttaylor27272727 Sep 03 '20 at 00:37
  • @Matt I made an update to the main post. I think you are onto something, but trying to figure out why it keeps happening this way! – ttaylor27272727 Sep 03 '20 at 01:01
  • 1
    Just do a search on the Azure DevOps UI for that branch name. If it is in two difference folders for Feature/feature that will be the problem. You will need to first clean it up on the remote. One of those branches needs to win out and the other needs to be removed. Then you probably need to run your steps to clean local. What is probably happening is you have one version. You push and it is trying to update the other. Your starting points probably don't align and it thinks you have a bad ref. Take a look at this: https://stackoverflow.com/a/51540232/10761889 – Matt Sep 03 '20 at 13:00
  • @Matt: I've tried almost all the commands. The issue is this. We want to use feature now instead of `Feature` and I'm not sure how I need to migrate to `feature` because when I make a new branch as `feature/testApp` it will automatically store it under the current `Feature` – ttaylor27272727 Sep 04 '20 at 15:33
  • @Matt: Do you know of anyway to force users to only create feature/Blah and it not be Feature/blam in DevOps? – ttaylor27272727 Sep 05 '20 at 02:58

0 Answers0