I have my code in a private Github.com repo, and also in a private Microsoft Visual Studio Online git repo. Now I want to mirror / sync them automaticly. So that when I checkin something to Github, it also pushes to VS Online, and vice versa.
I know how to do this 'client-side', by adding extra push-remotes to my local repo. But is it possible to do this 'server-side' too? Using Github Webhooks or something from Microsoft?
Because otherwise I must instruct everyone who wants to work on the code, to add both remotes, or am I wrong?
To get started with the GitHub in VS Code, you'll need to install Git, create a GitHub account and install the GitHub Pull Requests and Issues extension. In this topic, we'll demonstrate how you can use some of your favorite parts of GitHub without leaving VS Code.
Select Options tab and check Allow Scripts to Access OAuth Token
Select Build tab and add a PowerShell task with the following script to sync all branches.
git branch -r | findstr /v "\->" | ForEach-Object {$br=$_.TrimStart(); git branch --track $br.TrimStart("origin/") $br}
$repoName = "$env:BUILD_REPOSITORY_NAME".split('/')[1]
$repoUri = "$env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI".Substring(8)+ "_git/$repoName"
git remote add vsts "https://$env:SYSTEM_ACCESSTOKEN@$repoUri"
git branch -r | findstr /v "\->" | ForEach-Object { $br=$_.TrimStart(" origin/"); git push -u vsts $br }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With