将我的Github存储库同步到MS Visual Studio Team Services [英] Syncing my Github repo to MS Visual Studio Team Services

查看:107
本文介绍了将我的Github存储库同步到MS Visual Studio Team Services的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是VSTS的新手,我试图将我的Github存储库同步到VSTS环境,以将我的工作环境完全集成到其中.我想同步我的Github仓库以更新VSTS上所做的任何更改.此过程非常混乱.

I am new to VSTS and trying to sync my Github repos to the VSTS environment to completely integrate my working environment to it. I want to sync my Github repos to update whatever changes made on VSTS. This procedure is very confusing.

我点击了以下链接: http://intranoggin.com/Blog/February-2017/Synchronizing-code-between-GitHub-and-VSTS.aspx

新界面并不能完全反映本教程,但是我可以遵循大部分内容.我做了以下事情:

The new interface does not totally reflect the tutorial, but I was able to follow most parts. I did the followings:

我创建了Builds的新定义

I create a new definition of Builds

将其链接到我的github存储库

link it to my github repo

设置访问令牌

按照上面的教程链接所述设置任务命令

set task commands just as stated in the tutorial link above

保存定义并创建一个运行任务的队列

save the definition and create a queue that runs the task

当我在Github中对单个分支进行更改时,此方法效果很好.

This worked well when I made changes a single branch in Github.

但是我最终想做的是:

我希望它与Repo本身(包括所有分支)同步.因此,如果我为拉取请求"创建一个新分支,则希望它自动应用于VSTS.

I want it to sync with the Repo itself including all Branches. So, if I create a new branch for Pull Request, I want it to get applied to VSTS automatically.

我真的需要已经使用VSTS并知道如何与Github仓库和VSTS完全同步的人提供帮助

I really need help from someone who already has been using VSTS and knows how to make a complete Sync with Github repos and VSTS

推荐答案

如果您始终对VSTS git repo进行更改,并且需要相应地同步github repo,那么您可以使用一个VSTS CI构建定义实现它. 详细步骤如下:

If you always make changes on VSTS git repo and need to sync github repo correspondingly, then you can use one VSTS CI build definition to achieve it. Detail steps as below:

  • 使用PowerShell任务创建CI构建;
  • 在获取来源"步骤中选择VSTS git repo;
  • 启用持续集成并指定包括分支过滤器的所有分支:

  • Create a CI build with a PowerShell Task;
  • Select the VSTS git repo in Get sources step;
  • Enable continuous integration andspecify include all branches for Branch filters:

为PowerShell任务添加powershell脚本,如下所示:

Add the powershell script for PowerShell task as below:

git checkout $(Build.SourceBranchName)
git remote add github https://username:password@github.com/username/reponame
git push github $(Build.SourceBranchName)

  • 确保已取消为PowerShell任务选择标准错误失败"选项:

  • Make sure Fail on Standard Error option for PowerShell task is deselected:

    现在,在对VSTS git repo进行任何更改之后,github repo将自动更新.

    Now after any changes is made on the VSTS git repo, github repo will be updated automatically.

    这篇关于将我的Github存储库同步到MS Visual Studio Team Services的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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