phpazure-web-app-servicekuduazure-linux

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


When following the Azure App Service PHP quick start guide you receive the below error;

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)

Solution

  • The target deployment branch was set to 'main' instead of main despite following the instructions.

    Change

    To

    Note: I was using azure cli via cmd.exe except for the line setting php version as the Pipe character caused issues. It would be interesting know if using Cloud Cli would have avoided the issue entirely.