Push to local Azure DevOps Git from Build Pipeline

随声附和 提交于 2019-12-01 05:18:30

To push change to Azure DevOps, you should integrate your credential in Git repo URL:

  • First, create a PAT if you not have.
  • Then use below command to push:

    git push https://Personal%20Access%20Token:PAT@xxx.visualstudio.com/YYY/_git/zzz master
    

You shouldn't have to go the PAT route for auth - according to this, if your repo is part of the same Azure DevOps project as the build pipeline, credentials should just flow. Is it possible you haven't authorized the build agent to write to your repos? Two things are needed:

  • Under Project Settings -> Repositories for your Azure DevOps project, allow the Project Collection Build Service entity Contributor rights to the appropriate repo (or all project repos).

  • Allow scripts to access the OAuth token under the "Agent job" settings:

Also note a bad gotcha: this won't work for submodule operations, since DevOps does not automatically flow the credentials to the submodule instances, and the only symptom is a silent hang. Workaround to flow credentials manually is found here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!