将更新从azure推送到github [英] push updates from azure to github

查看:70
本文介绍了将更新从azure推送到github的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是天蓝色开发人员的新手,并且面临在天蓝色开发人员和github之间集成的问题,也许您可​​以帮上忙.我的问题是我如何将在蔚蓝devop存储库上完成的提交推送到驻留在我的github帐户上的相应存储库上?

i am new to azure devops and facing problem to integrate between azure devops and github, may be you could help. my question is how can i push commits that are done on the azure devop repo to corresponding repo which resides on my github account?

例如:1)我从github私有仓库导入文件abc.py2)我对Azure devops repo中的abc.py进行更改并提交.3)现在,我在azure repo的master分支上对abc.py所做的所有提交都应从以前的导入位置推送到我的私人github repo中的master分支的abc.py中.

For example: 1)i import a file abc.py from github private repo 2)i make changes to abc.py in azure devops repo and commits it. 3)now all the commits i made to abc.py on master branch of azure repo should be pushed to abc.py of master branch in my private github repo from where it was previously imported.

感谢您的帮助.

推荐答案

您可以尝试将命令行脚本任务添加到构建管道的代理作业,然后通过将更新推送到githubgit命令.

You can try adding a Command Line Script task to the agent job of the build pipeline, and then push the update to github via the git command.

任务中添加的命令如下:

The commands added in the task are as follows:

    git clone https://github.com/XXX/XXX.git
    git config --global user.name "XXX"
    git checkout master
    git add .
    git commit -m "abc"
    git push https://%gt%@github.com/xxx/xxx.git

这是我的样本:

注意:您需要在推送网址中提供github PAT,如下例所示:

Note:You need provide your github PAT in push url, like the example below:

git push https://{yourPAT}@github.com/xxx/yyy.git

要保护您的PAT,可以使用gitHubPat等安全变量,将变量类型更改为secret.

To protect your PAT, you could use secure variable , such as gitHubPat, change variable type to secret.

然后,在我的示例中,您可以添加一个环境变量:gt.然后将其值设置为$(gitHubPat).在命令行任务中,您使用double %%来获取环境变量"gt"的值.

Then you could add an Environment Variable, in my example: gt. Then set its value to $(gitHubPat).In command line task, you use double %% to get the value of environment variable "gt".

如果您需要将更新从azure devops存储库实时推送到github存储库,则可以在Build Triggers 中设置并选中 Enable持续集成选项.因此,如果您的master分支发生更改,它将触发ci build,您的更新将被推送到github repo.

If you need to push the updates from your azure devops repo to github repo in real time, you can set in Build Triggers and check the Enable continuous integration option.So if your master branch changes, it will trigger ci build, your update will be pushed to github repo.

希望这会有所帮助.

这篇关于将更新从azure推送到github的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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