As the title indicates, I have an issue making a build step in VSTS / Azure DevOps, where I would like to update an external git repo when I push to ie. my realease or master branch. I've tried several add ons from the marketplace, but none of them seems to fit my needs. I have a few prerequisites:
- My external git is behind port 33
- My external git only accepts SSH keys as authentication so I need to store an SSH private key somewhere to be able to push to the external source.
I have alternatively also tried Gitlab because of the built in mirroring feature, but unfortunately that won't accept port 33, only 22 and other standard ports :-(
Thank you so much in advance!
You could add a PowerShell Build Step with a Condition if the 'Build.SourceBranch' matches 'master' or 'release', and then the PowerShell script being something like this example. This pushes everything in one go, not each commit. This can also catch up a repo that is behind.
Notice that I'm using port # 1234, whereas if you do not specify a port, then 22 is the default. Please use this snippet in your overall solution. You could also use a git-hook to push changes.