在 Azure 上使用 Git 子模块持续部署 VSTS 应用程序失败

Sil*_*hus 1 git azure git-submodules continuous-deployment azure-web-app-service

我正在尝试使用Deployment sourceAzure Web 应用程序中的选项将包含子模块的 VSTS(Visual Studio Team Services)Git 应用程序部署到 Azure 。

所有子模块都托管在同一个 VSTS 项目中,但位于不同的 Git 存储库下。

部署到 Azure 失败并显示以下错误消息:

致命:无法读取“ https://XXX.visualstudio.com ”的用户名:错误的文件描述符\n将“ https://XXX.visualstudio.com/defaultcollection/Project/_git/Project.API.Models ”克隆到子模块中路径“lib/api-models”失败\n\r\nD:\Program Files (x86)\Git\cmd\git.exe 子模块更新 --init --recursive

有什么方法可以将包括子模块在内的 Git 项目部署到 Azure?

Sil*_*hus 5

所以我想出了一个关于如何在 Azure 上使用子模块进行 git 部署的解决方法。

  1. 通过单击 VSTS 中的克隆,然后单击个人访问令牌来创建个人访问令牌。
  2. 复制访问令牌并修改.gitmodules文件中所有子模块的 URL 。
  3. 之后 git 模块的 url 应如下所示: https://deployment:YOURCOPIEDAPIKEY@XXX.visualstudio.com/defaultcollection/Project/_git/Project.API.Models

确保将 API 密钥粘贴到所有子模块和子模块的子模块中。提交并推动,你就可以开始了。deployment在这种情况下,用户名可以是任何随机名称。