Dou*_*oug 5 git deployment azure continuous-deployment azure-functions
我有一个 Azure Function App,它被设置为从 VisualStudio.com Team Services git 存储库持续部署。它使用子模块。其中一个子模块在 GitHub 上公开可用,它加载得很好,没有任何问题。
另一个子模块受 VisualStudio.com Team Services Git 存储库的保护(与主存储库在同一帐户下)。此子模块在部署时出错。
根据 Microsoft 提供的信息,使用以下两个 git 命令启动子模块:
git submodule sync
git submodule update --init --recursive --force
Run Code Online (Sandbox Code Playgroud)
这些命令中的第一个似乎可以正确执行,而第二个似乎出错了。以下是输出:
Cloning into 'secure-submodule'...
Fatal: COMException encountered.\r
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for ''https://myVSStudio.visualstudio.com': Invalid argument
fatal: clone of 'https://myVSStudio.visualstudio.com/DefaultCollection/_git/secure-submodules' into submodule path 'secure-submodules' failed
Run Code Online (Sandbox Code Playgroud)
我假设这是因为第二个子模块需要凭据,但我不确定如何提供它。
由于主要项目的持续部署是从受保护的 git 存储库中提取的,我认为子模块也可以这样做。
作为解决方法,我更新了 .gitmodules 文件,以便 URL 包含用户名和密码,并创建了一个要在 URL 中使用的个人访问令牌。
例如,在 .gitmodules 中,url 已更改:
[submodule "mySub"]
path = mySub
url = https://mysub:PERSONAL_ACCESS_TOKEN_VALUE@YOUR_GIT_REPO_URL
Run Code Online (Sandbox Code Playgroud)
可以通过以下方式进行设置:
https://YOUR_SUB_DOMAIN.visualstudio.com/_details/security/tokens
当我创建个人访问令牌时,我将其仅限于代码读取操作。
我不喜欢这个解决方案的地方(我希望其他人有更好的解决方案):
| 归档时间: |
|
| 查看次数: |
867 次 |
| 最近记录: |