0

I'm building my first pipeline using Power Platform Build Tools. I'm trying to export a Dynamics model driven app to a repo. I'm getting an error with in my Command Line Script. The following is the error log:

2021-01-21T08:48:04.6191345Z ##[section]Starting: Command Line Script
2021-01-21T08:48:04.6292483Z 
==============================================================================
2021-01-21T08:48:04.6292831Z Task         : Command line
2021-01-21T08:48:04.6293131Z Description  : Run a command line script using Bash on Linux and macOS 
and cmd.exe on Windows
2021-01-21T08:48:04.6293422Z Version      : 2.178.0
2021-01-21T08:48:04.6293630Z Author       : Microsoft Corporation
2021-01-21T08:48:04.6293952Z Help         : 
https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2021-01-21T08:48:04.6294293Z 
==============================================================================
2021-01-21T08:48:05.7216764Z error: pathspec 'master' did not match any file(s) known to git
2021-01-21T08:48:05.7217182Z Generating script.
2021-01-21T08:48:05.7217463Z ========================== Starting Command Output 
===========================
2021-01-21T08:48:05.7217952Z ##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL 
"D:\a\_temp\93c0ac5e-da28-4265-b4d0-4326b5f38209.cmd""
2021-01-21T08:48:05.7218457Z commit all changes
2021-01-21T08:48:05.7218642Z push code to new repo
2021-01-21T08:48:05.7226781Z fatal: pathspec '-' did not match any files
2021-01-21T08:48:05.7227220Z error: pathspec 'export"' did not match any file(s) known to git
2021-01-21T08:48:06.2395991Z git: 'bearer' is not a git command. See 'git --help'.
2021-01-21T08:48:06.2983259Z ##[error]Cmd.exe exited with code '1'.
2021-01-21T08:48:06.3323471Z ##[section]Finishing: Command Line Script

Based on this output, I don't know what is missing.

enter image description here

enter image description here

user1647160
  • 491
  • 1
  • 10
  • 25
  • Just by looking at the error messages, it could be that something is wrong with the git commands, most likely about the git branches. Could you please provide some sample scripts of your yaml (or some relative screenshots of your tasks if you are using classic UI pipeline)? So that people can investigate the question further. – Jane Ma-MSFT Jan 22 '21 at 05:43
  • @JaneMa-MSFT. I'm using the classic UI. I've uploaded a screenshot of the tasks I'm using. – user1647160 Jan 24 '21 at 04:06
  • I'm sorry for my late reply. Please check whether my answer below can help you and feel free to comment. – Jane Ma-MSFT Jan 27 '21 at 06:37

2 Answers2

1

According to your screenshots, your default branch is "main", not "master".

enter image description here

The master did not match any branches known to git, so the task failed.

In addition, you need to use origin/{branch} instead of {branch}. As the branch is a remote branch.

Jane Ma-MSFT
  • 4,461
  • 1
  • 6
  • 12
0

Error with Command Line Script in Azure DevOps Pipeline

This may be because your git command has wrong syntax.

According to the image you provided, we could to know the git command line you used is:

enter image description here

This is not the correct syntax to add all files, that also the reason why you get the error:

fatal: pathspec '-' did not match any files

If I use the same syntax git add —— all, I will get the same error message.

To resolve this error, please try to use following correct syntax:

git add --all

Besides, we could not use the AUTHORIZATION:BEARER with $(system.AccessToken), you need to use Authorization: Basic with Base64-encode:

Please check this thread for some more details.

That the reason why you get the error git: 'bearer' is not a git command..

To resolve this issue, you could use git command line with PAT directly to push the files:

git push https://<Your PAT>@dev.azure.com/<YourOrganization>/<YourProject>/_git/MyTestProject HEAD:master

In addition, what Jane said is another issue.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135