簡體   English   中英

Azure DevOps 管道中的命令行腳本出錯

[英]Error with Command Line Script in Azure DevOps Pipeline

我正在使用 Power Platform Build Tools 構建我的第一個管道。 我正在嘗試將 Dynamics model 驅動的應用程序導出到存儲庫。 我的命令行腳本出現錯誤。 以下是錯誤日志:

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://docs.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

基於這個output,不知道少了什么。

在此處輸入圖像描述

在此處輸入圖像描述

根據您的屏幕截圖,您的默認分支是“main”,而不是“master”。

在此處輸入圖像描述

master沒有匹配到 git 已知的任何分支,因此任務失敗。

此外,您需要使用origin/{branch}而不是{branch} 由於分支是遠程分支。

Azure DevOps 管道中的命令行腳本出錯

這可能是因為您的 git 命令語法錯誤。

根據您提供的圖像,我們可以知道您使用的 git 命令行是:

在此處輸入圖像描述

這不是添加所有文件的正確語法,這也是您收到錯誤的原因:

fatal: pathspec '-' did not match any files

如果我使用相同的語法git add —— all ,我會得到相同的錯誤信息。

要解決此錯誤,請嘗試使用以下正確語法:

git add --all

此外,我們不能將AUTHORIZATION:BEARER$(system.AccessToken)一起使用,您需要將 Authorization: Basic 與 Base64-encode 一起使用:

請檢查此線程以獲取更多詳細信息。

您收到錯誤git: 'bearer' is not a git command. .

要解決此問題,您可以使用帶有 PAT 的 git 命令行直接推送文件:

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

另外,簡說的又是一個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM