Azure devops 使用azure devops将文件提交到azure git repo

Azure devops 使用azure devops将文件提交到azure git repo,azure-devops,azure-devops-pipelines,azure-git-deployment,Azure Devops,Azure Devops Pipelines,Azure Git Deployment,如何使用构建管道将文件提交到azure git repo 我正在从azure ci管道生成一些文件,我想将这些文件提交到我在ci管道中使用的同一个repo中 我已经添加了azure CLI任务,并添加了一个内联命令来提交代码,但它给了我一个错误,无法工作 git add . git commit -m "test commit" git push -u origin Trunk 请确保项目集合生成服务帐户和生成服务()在贡献部分中都有允许: 假设你已经完成了所有步骤,你应

如何使用构建管道将文件提交到azure git repo

我正在从azure ci管道生成一些文件,我想将这些文件提交到我在ci管道中使用的同一个repo中

我已经添加了azure CLI任务,并添加了一个内联命令来提交代码,但它给了我一个错误,无法工作

git add .
git commit -m "test commit"
git push -u origin Trunk

请确保
项目集合生成服务帐户
生成服务()
贡献
部分中都有
允许


假设你已经完成了所有步骤,你应该准备好了。请注意,文档说明您应该设置
项目集合生成服务
,但对于经典模式管道,还需要设置
项目集合生成服务帐户

您可以启用
允许脚本访问OAuth令牌
选项

并授予回购贡献项目集合构建服务帐户的权限

Git命令:

   git config --global user.email "email"
   git config --global user.name "Kevin Lu"

   git add .

   git commit -m "My commit message"

   git push origin master
对于Yaml管道:

您可以在YAML示例中设置
persistCredentials:true

并授予Repo贡献构建服务的权限

Yaml样本:

steps:
- checkout: self
  persistCredentials: true

- script: |
   git config --global user.email "email"
   git config --global user.name "Kevin Lu"
       
   git add .
   
   git commit -m "My commit message"
   
   git push origin master
   
  displayName: 'Command Line Script'

有关更多详细信息,请参阅。

您是否遵循了文档中的这些步骤?是,它给我“无法提示,因为用户交互已被禁用”错误。您好@jaydepsinh有关于此票证的任何更新吗?如果这个建议能给你一些帮助,请随时告诉我。只是提醒一下。另外,我在git add“git remote set url origin url”之前添加了这个url,在git add set origin之前添加了这个url,方法是将这个url指定为“git remote set url origin url”