1

At work we have to use Bitbucket and to create the new branches we have to use the webpage. When I do this and try to update my local repo using git pull I can see all the code, commits and even branches created by other users are pulled from remote except for the branch I recently created.

Then I have to keep trying git pull and see the message Already up to date. for 15 or 20 minutes until suddenly the branch is updated.

I was using https to clone the repos and I realized that using SSH started to avoid this issue, but a few weeks later I'm starting to see this issue again with SSH as well.

I'm assuming the issue is related to Bitbucket but I haven't found any info. Is there a way to avoid this? or maybe a way to force the update?

torek
  • 448,244
  • 59
  • 642
  • 775
ElMaya
  • 11
  • 2
  • 1
    If Bitbucket are delivering stale cached data, nothing you do with *Git itself* will fix that. You will need some way to poke Bitbucket directly. It would be surprising if Bitbucket are doing this, though; other Git hosting sites such as GitHub and GitLab do not do that, so they'd bleed customers who would move to these other providers who are providing better service. – torek Sep 09 '21 at 18:36
  • Hi @torek, I'll try to check with IT this, maybe it's some kind of wrong configuration on our side while using Bitbucket or maybe even it's on my side, because it seems I'm the only one seeing this so far, but you're right it will be weird that Bitbucket is doing that – ElMaya Sep 15 '21 at 02:53
  • My first guess would be a misconfigured cache on your side that (in effect) thinks: *Oh, this bitbucket connection, we don't need to do that, we'll just re-deliver the old data, it's gotta still be fine* but that would break http(s) but not ssh (I think). – torek Sep 15 '21 at 03:26

1 Answers1

0

Try first a git fetch, or even a git ls-remote

The goal for the ls-remote command is to check (right after creating/pushing a new branch) if:

  • said new branch is immediately listed in the remote tracking branches listed by ls-remote
  • the associated HEAD SHA1 for that branch is the right commit (the latest pushed on that branch)
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I have tried `git fetch` several times because at the beginning I was searching for questions like "git pull not working" and the first suggestion always is to use fetch instead but it doesn't work (or at least immediately, I don't know if I have to stop using pull at all). Thanks I'll try `git ls-remote` to check what git is seeing, because I manually go to Bitbucket web page and can see my branch there – ElMaya Sep 15 '21 at 02:57
  • @ElMaya "because I manually go to Bitbucket web page and can see my branch there": then no amount of fetch of ls-remote will list that branch, if it was never pushed. – VonC Sep 15 '21 at 05:28