1

I am trying to checkout code from AWS Codecommit in an Azure Pipeline job. However, the dynamic build agent is complaining that it cannot find master branch.

I am restricted to only classic editor as AWS Codecommit falls under generic git repository. I couldn't tinker the git checkout stage where I can fetch the entire list of branches in remote.

From https://git-codecommit.ap-south-1.amazonaws.com/v1/repos/inxxxxxx
 * [new branch]      master       -> origin/master
##[debug]STDOUT/STDERR stream read finished.
##[debug]STDOUT/STDERR stream read finished.
##[debug]Exited process 4361 with exit code 0
##[debug]Finished process 4361 with exit code 0, and elapsed time 00:00:05.5947164.
##[debug]Processed: ##vso[telemetry.publish area=AzurePipelinesAgent;feature=GitFetch]{"ElapsedTimeMilliseconds":"5597","RefSpec":"","RemoteName":"origin","FetchDepth":"0","ExitCode":"0","Options":"--force --tags --prune --progress --no-recurse-submodules origin "}
##[debug]Processed: ##vso[task.setprogress value=80]Starting checkout...
##[debug]refFetchedByCommit : 
##[debug]Checkout refs/remotes/origin/master.
git checkout --progress --force refs/remotes/origin/master
##[debug]Starting process:
##[debug]  File name: '/usr/bin/git'
##[debug]  Arguments: 'checkout --progress --force refs/remotes/origin/master'
##[debug]  Working directory: '/home/vsts/work/1/s'
##[debug]  Require exit code zero: 'False'
##[debug]  Encoding web name:  ; code page: ''
##[debug]  Force kill process on cancellation: 'False'
##[debug]  Redirected STDIN: 'False'
##[debug]  Persist current code page: 'False'
##[debug]  Keep redirected STDIN open: 'False'
##[debug]  High priority process: 'False'
##[debug]Updated oom_score_adj to 500 for PID: 4381.
##[debug]Process started with process id 4381, waiting for process exit.
error: pathspec 'refs/remotes/origin/master' did not match any file(s) known to git
##[debug]STDOUT/STDERR stream read finished.
##[debug]STDOUT/STDERR stream read finished.
##[debug]Exited process 4381 with exit code 1
##[debug]Finished process 4381 with exit code 1, and elapsed time 00:00:00.0069196.
##[error]Git checkout failed with exit code: 1
##[debug]Processed: ##vso[task.logissue type=error;]Git checkout failed with exit code: 1
##[debug]Processed: ##vso[task.complete result=Failed;]
##[debug]   at Agent.Plugins.Repository.GitSourceProvider.GetSourceAsync(AgentTaskPluginExecutionContext executionContext, RepositoryResource repository, CancellationToken cancellationToken)
   at Agent.Plugins.Repository.CheckoutTask.RunAsync(AgentTaskPluginExecutionContext executionContext, CancellationToken token)

enter image description here

How to resolve this checkout error in Azure Pipeline? How to fetch all the branches including the master branch?

CK5
  • 1,055
  • 3
  • 16
  • 29

1 Answers1

0

The issue was the wrong branch name. It should be master.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107