powershell - 使用 Azure Powershell 或 xpat cli 如何将我的网站连接到 github Hook

标签 powershell azure github azure-web-app-service

使用门户:

使用门户 https://manage.windowsazure.com/这很容易。从新创建的 azure 网站:

  1. 前往仪表板
  2. 在右侧的快速浏览选项中,点击“从源代码管理设置部署”
  3. 关于“你的源代码在哪里?”选项,选择 Github
  4. 授权,然后选择存储库名称和分支。
  5. BINGO:现在推送到该分支将触发该分支部署到 azure 网站上。可爱。

问题是这样的:

我一生都无法了解如何从命令行执行此操作(使用使用 npm 安装的 xpat-cli:“npm install azure-cli -g”)

看来我应该输入类似的内容:

azure site deployment github --verbose --githubusername [username] --githubrepository [username/reponame] [sitename]

因为“azure站点部署github”的帮助说它将:“将网站链接到github帐户进行部署”

但似乎不起作用...

如果我输入:

azure site show [sitename]

输出显示源代码控制是“LocalGit”而不是 github - 如果我按照上面的门户方式进行操作,它就是这样的。

Source Control
data:    --------------
data:    Type:            LocalGit 

有什么想法吗?

最佳答案

根据您的用例,解决方案会有所不同。

  1. 假设您有相同的 github 源,但想要部署到多个不同的 Azure 网站 潜在的解决方案:使用部署到 Azure 按钮请参阅此处的详细信息:https://azure.microsoft.com/blog/2014/11/13/deploy-to-azure-button-for-azure-websites-2/

  2. 假设您有多个想要部署到 Azure 的存储库: 潜在的解决方案:我假设您将是部署它的人。工作流程如下:

    A.从 Github 下载文件到本地文件夹参见 here

    B.将本地文件夹发布到新的/现有的 Azure 站点。请参阅此处或此处。还有其他 github 存储库可以立即获取一些脚本

我知道这并不直接 Hook 您的系统来进行直接拉取,但它是一种实现方法。
还有:

http://www.imtraum.com/blog/streamline-git-with-powershell/ https://gallery.technet.microsoft.com/scriptcenter/a-GitHub-Repository-265c0b49

关于powershell - 使用 Azure Powershell 或 xpat cli 如何将我的网站连接到 github Hook ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31424268/

相关文章:

powershell - 如何使用 PowerShell 从文件名中删除表情符号?

Powershell 无法正确读取负数

azure - 注销在 Microsoft Azure Web App 中不起作用

azure - 是否可以在 azure web 应用程序中创建与主机文件等效的文件

unit-testing - 如何对 U-SQL 脚本进行单元测试?

git - 如何正确删除推送到 Git 存储库的敏感数据?

git - 如何整合Git + Github + Google Drive?

powershell - 使用 Powershell 从 .zip 文件中删除文件

variables - powershell - 删除所有变量

android - Android studio 中的 Github "PUT"请求