当前部署分支为“'main'”,但尚未向其推送任何内容

The current deployment branch is ''main'', but nothing has been pushed to it

按照 Azure 应用服务 PHP 快速入门指南操作时,您会收到以下错误;

remote: The current deployment branch is ''main'', but nothing has been pushed to it
remote: Error - Changes committed to remote repository but deployment to website failed.
remote: Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
remote:    at Kudu.Console.Program.PerformDeploy(String appRoot, String wapTargets, String deployer, String lockPath, IEnvironment env, IDeploymentSettingsManager settingsManager, TraceLevel level, ITracer tracer, ITraceFactory traceFactory, IOperationLock deploymentLock)
remote:    at Kudu.Console.Program.Main(String[] args)
remote: Aborted (core dumped)

尽管遵循了说明,但目标部署分支设置为 'main' 而不是 main

改变

  • az webapp config appsettings set --name <app-name> --resource-group myResourceGroup --settings DEPLOYMENT_BRANCH='main'

  • az webapp config appsettings set --name <app-name> --resource-group myResourceGroup --settings DEPLOYMENT_BRANCH=main

注意:我通过 cmd.exe 使用 azure cli,但行设置 php 版本除外,因为管道字符导致了问题。知道使用 Cloud Cli 是否可以完全避免这个问题会很有趣。