我要做的是向您的 Azure DevOps 服务存储库添加一个远程,它指向您的内部 TFS(只要您的内部 TFS 从 Internet 可见)然后在您的构建中(在服务中),您可以调用 git push internalorigin。现在,如果您从网络上看不到您的内部 TFS,那么就像 Cece 提到的那样,在您的 TFS 服务器上安装一个构建代理,并在构建中创建一个代理步骤,然后调用内联 powershell 添加一个远程,然后调用 git push internalorigin像这样的东西
然后在脚本中你可以做这样的事情
git remote add internalorigin https://TFSSERVER/COLLECTION/_git/REPO
git push -u internalorigin --all
更新:
从 Git 到 TFVC,您的内联脚本会将本地文件从构建复制到本地 TFVC 工作区,然后使用 TF.exe 签入类似这样的内容
copy c:\agent\_work\1\s c:\workspace /Y
cd c:\workspace
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\Team Foundation\Team Explorer\TF.exe" vc checkin /comment:"comment" /noprompt /recursive *
您必须首先从命令行尝试它,确保它可以工作,然后将其放入内联脚本中。