I'm attempting to set my company up with a Visual Studio Team Services repository, and sync it with a private Github repo. There are only a handful of us that work on the tech side, but some like to use VSTS and some like to use Github.
The documentation everywhere says that you can sync the two. That way changes made in Github will show up in Visual Studio Online, and vice-versa. I'm learning that's easier said than done.
I've attempted to follow the directions provided by Microsoft, and have not found any solutions to my problem. I can clone the existing Github repo easily enough, but changes there don't sync to the VSTS repo.
I tried the following instructions as well:
How to synchronize VSTS and Github respositories when commits are made
The build passes, and it even shows what commits it has picked up. However new files and/or any changes do not appear in the VSTS repo at all.
Can someone please help??
Simple way to sync VSTS repo from Github repo.
- Add GitHub service endpoint to your VSTS (Setting > Service)
- Create an Empty build definition with GitHub repository in your VSTS
- Select Repository tab and specify Connection, Repository and Default branch. (set Clean to true if necessary)
- Select Triggers tab and check Continuous integration, Batch changes and specify Branch filters
- Select Options tab and check Allow Scripts to Access OAuth Token
- Select Build tab and add Command Line step/task (Tool:
[Git tool path]
; Arguments: push https://$(System.AccessToken)@[xxx].visualstudio.com/[teamproject]/_git/[repo name] HEAD:[branch]
; Working folder: $(Build.SourcesDirectory)
You can do it all in the same directory by adding a second remote origin, if you've already added VSTS as 'origin', then run:
git remote add github https://github.com/user/repo.git
then you can push up your changes you've made to the two repos
to push to VSTS:
git push origin
and then to push to GitHub
git push github
See this github doc page
If you wanted to automate this you might want to set it up as a scheduled task on a machine, or you can get it connected to git hooks on VSTS?
Actually you can use "Git Mirror" from marketplace.
https://marketplace.visualstudio.com/items?itemName=nobitagamer.gitmirror