0

I have a private Git repo hosted in BitBucket Cloud, and I am using Azure DevOps to run a YAML pipeline against it. The repo was originally hosted in Azure DevOps, but was recently migrated over to BitBucket and the pipeline updated.

When I use the default options to run the pipeline (so Git uses the latest commit from the specified branch) everything works fine; but if I enter a specific commit SHA in the Commit input box, then when DevOps tries to check out the repository then it fails as follows:

git --config-env=http.extraheader=env_var_http.extraheader fetch --force --no-tags --prune --prune-tags --progress --no-recurse-submodules origin  +17fce92
fatal: couldn't find remote ref 17fce92
##[warning]Git fetch failed with exit code 128, back off 5.56 seconds before retry.
git --config-env=http.extraheader=env_var_http.extraheader fetch --force --no-tags --prune --prune-tags --progress --no-recurse-submodules origin  +17fce92
fatal: couldn't find remote ref 17fce92
##[warning]Git fetch failed with exit code 128, back off 5.088 seconds before retry.
git --config-env=http.extraheader=env_var_http.extraheader fetch --force --no-tags --prune --prune-tags --progress --no-recurse-submodules origin  +17fce92
fatal: couldn't find remote ref 17fce92
##[error]Git fetch failed with exit code: 128

Given that it will build happily when I don't specify the commit, does anyone have any idea what I'm doing wrong?

David Keaveny
  • 3,904
  • 2
  • 38
  • 52
  • Sound like AzDO use `git fetch`, but this command don't accept a commit hash. Maybe you can add a tag on that commit and specify the tag name to AzDO. – vernou Nov 14 '22 at 22:34

1 Answers1

1

You need to specify the full commit ID instead of the short one.

I can reproduce the issue with short hash, but it works for long hash.

Failed with the short hash: enter image description here

Worked with full commit ID (long hash): enter image description here

Andy Li-MSFT
  • 28,712
  • 2
  • 33
  • 55
  • @David Keaveny May I know if the solution works for you? – Andy Li-MSFT Dec 02 '22 at 07:24
  • Thanks for your help, Andy - looks like that was the issue. It's a little annoying that Azure shows the short hash everywhere, but then expects you to dig a bit further to provide the long hash. – David Keaveny Feb 01 '23 at 05:21