How to add another repo/remote to the same folder directory
Overview
Usually all source code version control is done inside our company repo but in some situations we need to publish the code to the customer’s repo when a new version is ready to production.
It’s not rare to send over the code zipped but then the customer will not be able to track the changes made on those files.
But now that DevOps concepts is on the spot we are also entitled to publish the release version to the customers’ repo and this action will trigger some code analysis, tests, and deployment!
So why not push the code/branch directly to customer’s repo maintaining the commits that had been made during development.
Solução
In this post I’ll use two repos that I created previously:
- One on GitHub as “primary” (Consulting);
- Another one on Azure DevOps as “secondary” (Customer).
I’ve published a .NET Core project with some initial commits on GitHub’s repo:
Now, to push these files to Azure DevOps repo with the commits history we need to add another remote to our local repo:
- Git remote add <alias> <remote-git-url>
To push the “secondary” repo:
- Git push secondary
Done! We can see our code (with history) on Azure DevOps repo!