提交时如何同步VSTS和Github存储库 [英] How to synchronize VSTS and Github respositories when commits are made

查看:200
本文介绍了提交时如何同步VSTS和Github存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio团队服务中有一个存储库,我希望与github存储库保持同步。

这使我可以在VSTS中完成我的主要开发,并且在合并到主人时,它将同步到github,并允许其他人在github上贡献,当Pull Request合并到主同步到VSTS。

解决方案

首先在VSTS上创建一个新的构建,该构建使用应同步的存储库VSTS:



添加两个CMD任务将运行一些git命令。



最后一个这两个需要一个来自Github的个人访问令牌。



在图像中,两个CMD任务都使用GIT工具和以下两个命令:

  pull https://github.com/s-innovations/MessageProcessor.ServiceFabric.git master 

  push https:// $(githubpersonaltoken)@github。 com / s-innovations / MessageProcessor.ServiceFabric.git head:master 

启用CI选项以触发建立运行,只要有东西承诺掌握。



现在可以通过另一种方式完成相同的操作,其中新构建被制作为相同的wa y,但将网址更改为以visual studio online repository为目标。

=nofollow noreferrer>
$ b $注意,当在vsts上使用个人令牌时,url的认证部分需要 https://: token @ 和github上的 https:// token @

  push https:// $(vstspersonaltoken)@ sinnovations.visualstudio.com / DefaultCollection / S-Innovations%20MessageProcessor / _git / messageprocessor-service-fabric head:master 



2017年8月更新



他们在VSTS中改变了它,例如冒号出现就会失败。上述说明已更新。


I have a repository in visual studio team services that I would like to keep synchronized with a github repository.

This allows me to do my main development in VSTS and when merging into master it will be synced to github and also allow others to contribute on github and when there Pull Requests are merged into master its synced to VSTS.

解决方案

First create a new build on VSTS that is using the repository that should be synced from VSTS:

add two CMD tasks that will run some git commands.

where the last of the two needs a personal access token from Github.

In the images both CMD tasks uses the GIT tool and the following two commands:

pull https://github.com/s-innovations/MessageProcessor.ServiceFabric.git master

and

push https://$(githubpersonaltoken)@github.com/s-innovations/MessageProcessor.ServiceFabric.git head:master

Enable the CI option to trigger the build to run whenever something is commited to master.

Now the same can be done the other way, where a new build is made the same way but with the urls changed to target visual studio online repository.

Do note that when using personal tokens on vsts the authentication part of the url needs to be https://:token@ and on github its just https://token@.

push https://$(vstspersonaltoken)@sinnovations.visualstudio.com/DefaultCollection/S-Innovations%20MessageProcessor/_git/messageprocessor-service-fabric head:master

Update AUG 2017

They changed it at VSTS, such if the colon is present it will fail auth. The above description have been updated.

这篇关于提交时如何同步VSTS和Github存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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