4

I have solution in VS, which connected to VSTS to keep repository there. I know I can connect to GitHub from VS, but I want to keep connection to VSTS at the same time.

So I want to publish to both: VSTS and GitHub from VS.

Is it possible?

Or I need to synchronize repositories as described in this answer?

I prefer to do it from VS.

Update: I use git repo in VSTS.

Community
  • 1
  • 1
Alexan
  • 8,165
  • 14
  • 74
  • 101

2 Answers2

5

Refer to these steps to add a new remote in VS 2015.

  1. Connect to your VSTS git repository
  2. Click Settings

enter image description here

  1. Click Repository Settings

enter image description here

  1. Click Add link in Remotes section

enter image description here

  1. After that you can choose a remote repository when you push/sync to remote repository.

enter image description here

starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53
1

Or I need to synchronize repositories as described in this answer?

This is preferable: you can initialize a git repo in your VSTS-managed repo, which means you can use the build phase to check and pull from the Git repo as described in the answer you mention.

That is because, if you chose to connect to connect to a Team Foundation Version Control (TFVC) repo, it cannot be a GitHub repo.

You can use Git and TFVC repos in the same team project, but you would still need build commands to synchronize that repo from GitHub, or configure said Git repo to push to two different upstream (TFVC and GitHub) repos.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I have got repo in VSTS. How I can configure connection to Github from VS interface, without dropping connection to VSTS? – Alexan Jan 22 '17 at 19:10
  • @Alex Not sure (beside https://www.visualstudio.com/en-us/docs/git/team-projects which is the opposite). I would simply (in command line) `git init .` and `git remote add origin https://github.com//` – VonC Jan 22 '17 at 19:13
  • okay, did it from command line. I just thought it could be easy to do from VS. – Alexan Jan 22 '17 at 22:12
  • @Alex " I just thought it could be easy to do from VS": not to my knowledge. – VonC Jan 23 '17 at 05:42