2

I have a project in VS2019 which is yet published in a GitHub repository, now my company decided to use Bitbucket as hosting for the git but i still want to be able to keep my project up to date in both GitHub and Bitbucket repos.

The issue is that VS seems to allow the publishing only to one repo, if i go in "sync" under Team Explorer once i connected the project to GitHub it doesn't allow to connect it to another repo.

That what i see once i published the project to GitHub under sync:

enter image description here

Is there a way by using VisualStudio GIT tools to publish the project in both GitHub and Bitbucket repos?

Kasper Juner
  • 832
  • 3
  • 15
  • 34

1 Answers1

-1

Solved by setting multiple remote on same origin so initially i had two remote branches one for bitbucket and one for github

like this:

git remove add origin github/my-project.git

git remove add bitbucket bitbucket/my-project.git

When i was executing the push it was only doing it on origin to it was pushing only to github repo.

Then by adding the following lines:

git remote set-url --add --push origin github/my-project.git
git remote set-url --add --push origin bitbucket/my-project.git

I've added multiple remote branches on same origin so at this point it was enough only to do a git push or git push origin to push the code to both remote branches.

This GitHub guide helped me in it.

Kasper Juner
  • 832
  • 3
  • 15
  • 34