在构建期间通过脚本从远程更新子模块? [英] Update submodules from remote via script during build?

查看:79
本文介绍了在构建期间通过脚本从远程更新子模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在这里看到了一些类似的问题,但我仍然遇到问题。我有一个Git存储库(托管在VSTS中),它有几个子模块,我想在我们的CI过程的构建脚本上更新。如果我运行:


git submodule update --remote


从命令行运行正常。但是,当我尝试通过命令行构建步骤运行它时,构建将挂起该步骤。当我最终取消构建时,我收到错误:


"致命:无法读取'https://< my account> .visualstudio.com'的用户名:无效的参数" ;


我有"Checkout子模块"在获取源下检查选项,该部分工作正常。我还有"允许脚本访问OAuth令牌"在构建定义中的选项下检查。 VSTS构建代理通过
私钥进行身份验证。


基于其他一些帖子,我尝试了一些方法,包括使用.gitmodules中URL的相对路径文件和各种不同格式的命令行来执行git命令。我已在
本地计算机上更新到最新的构建代理。


我不确定下一步该去哪里? 




Troy

解决方案

嗨特洛伊,


你想要吗?将子模块中的更改推送到远程?如果是这样,您需要导航到子模块路径,然后提交并推送。

如何

我是否"提交"git子模块中的更改?


如果您只需要拉/克隆子模块,checkout子模块选项应克隆子模块以构建代理。


关于git子模块更新,尝试更新子模块的URL用户名和密码,然后重试(例如
https:// test:[access token,可以使用System.AccessToken变量] @example .com / git / foo.git]


一些相关主题:


Git子模块URL不包括用户名?


git子模块更新与其他用户


问候


Starain


I saw a few similar questions on here, but I am still having issues. I have a Git repository (hosted in VSTS) that has several submodules which I would like to update on the build script for our CI  process. If I run:

git submodule update --remote

From the command line, it runs fine. However, when I try to run it via a command line build step, the build hangs on that step. When I finally cancel the build, I get the error:

"fatal: could not read Username for 'https://<my account>.visualstudio.com': Invalid argument"

I have the "Checkout submodules" option checked under Get Sources, and that part works fine. I also have "Allow scripts to access OAuth token" checked under Options in the build definition. The VSTS Build Agent is authenticating via a Private Key.

Based on some other posts, I have tried a few things, including using relative paths for the URLs in the .gitmodules file and a variety of different formats for the command line to execute the git command. I have updated to the latest build agent on the local machine.

I'm not sure where to go next? 


Troy

解决方案

Hi Troy,

Do you want to push change in submodule to remote? If so, you need to navigate to submodule path, then commit and push. How
do I "commit" changes in a git submodule?

If you just need to pull/clone submodule, the checkout submodules option should clone the submodule to build agent.

Regarding git submodule update, try to update the URL of submodule with username and password and try again (e.g. https://test:[access token, could use System.AccessToken variable]@example.com/git/foo.git]

Some related threads:

Git submodule URL not including username?

git submodule update with other user

Regards

Starain


这篇关于在构建期间通过脚本从远程更新子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆