Search code examples
gitgradleazure-pipelines

Azure Pipeline not able to list all git remotes


We have a gradle script where a git command is executed (git branch --remotes). Unfortunately when running this in new pipelines all that is returned is the current branch looking like origin/3a64b9307802044f4ab6c1332832d6067906d309. I think it is the head of that branch. Anyways, it's only one branch, when multiple branches should be there and it is not readable. We have old pipelines in which it runs just fine.

Same is also visible in the Checkout-phase of the azure pipeline, after resolving all deltas and the branches are listed. In old pipelines all branches are listed in human readable format while in the new pipeline only one branch is listed. It somehow does not affect tags, as they are all listed in both pipelines.

I already checked permissions of both (old, new) pipelines and they are equal and in fact everything seems equal.

Does anyone have any idea what could be the problem?


Solution

  • Check the Fetch Depth in the Pipeline Configuration. here is an addition you can add to the pipeline yaml file.

    steps:
    - checkout: self
      fetchDepth: 0