1

I have a Git repo on Azure DevOps and I am trying to fetch the origin/main branch. However, the command failed with Bash existed code 128.

fatal: could not read Username for 'https://xxx.xxx.com': terminal prompts disabled ##[error]Bash exited with code '128'.

This is my release pipeline definition:

# Release pipeline

pr: none
trigger: none

variables:
  vmImageName: 'ubuntu-latest'

pool:
  vmImage: $(vmImageName)

jobs:
  - job: release
    workspace:
      clean: all
    steps:
      # Install Node
      - task: NodeTool@0
        inputs:
          versionSpec: '16.14.x'
        displayName: 'Use node 16.14.x'

      # Authenticate private VivaCommonUX feed packages
      - task: npmAuthenticate@0
        displayName: 'npm Authenticate .npmrc'
        inputs:
          workingFile: .npmrc

      # Install Yarn package manager
      - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3
        inputs:
          versionSpec: '1.22.x'
        displayName: 'Use Yarn 1.22.x'

      # Check Node, NPM, Yarn version
      - script: |
          echo "Node Version: "
          node -v
          echo "NPM Version: "
          npm -v
          echoe "Yarn Version: "
          yarn -v
        displayName: 'Check Node, NPM, Yarn version'

      - script: |
          git fetch -- origin main
        displayName: 'fetch origin main'

The reason why I did git fetch -- origin main is to debug the issue. It performs a git fetch -- origin main under the hood.

Any reason why this happens?

1 Answer 1

1

Turns out an additional step is required for the pipeline have access to the system token. More information to enable git command in Azure DevOps here.

Add a checkout session with persistCredentials set to true.

steps:
  - checkout: self
    persistCredentials: true
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question