我正在尝试https://learn.microsoft.com/nl-nl/azure/app-service/app-service-web-get-started-html当然,我并没有严格按照要求行事。
我已经有一个网络应用程序(以及资源计划和其他东西)。我只是想添加本地 git 的东西。当我在 CLI 中列出应用程序的属性时,应该有这个属性 deploymentLocalGitUrl,但它不在那里。我如何通过 CLI 或仪表板添加它?
提前致谢。
干杯,埃里克!
最佳答案
gitdirectory=<Replace with path to local Git repo>
username=<Replace with desired deployment username>
password=<Replace with desired deployment password>
在azure上创建webapp后,配置网站以通过git进行部署。设置帐户级部署凭据。
$ az webapp deployment user set --user-name $username --password $password
此命令将返回要推送到的 Git 端点,其中包含用户名。
$ az webapp deployment source config-local-git --name mywebapp --resource-group myResourceGroup
返回结果如下:
{
"url": "https://<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8ffafceafde1eee2eacfe2f6f8eaedeeffffa1fcece2a1eef5fafdeaf8eaedfce6fbeafca1e1eafb" rel="noreferrer noopener nofollow">[email protected]</a>/mywebapp.git"
}
掌握端点后,cd 到 git 存储库并在 Git 中设置一个名为 azure 的新远程。
$ cd $gitdirectory //remember to git init before you cd
$ git remote add azure https://<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="63161006110d020e06230e1a1406010213134d10000e4d0219161106140601100a1706104d0d0617" rel="noreferrer noopener nofollow">[email protected]</a>/mywebapp.git
最后,您可以将应用程序部署到 Azure。
git push azure master
关于Azure Web应用程序在创建后添加deploymentLocalGitUrl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51032681/