I have setup a repository that points to heroku. In the "Optional Extended Integration" I have chosen "Bitbucket Server" as the host type, Host URL is set to "https://bitbucket.org" and the username is set to my username. Now whenever I commit a change to heroku I would like to commit that to Bitbucket as well. Unfortunately this does not seem to work with the setup I mentioned above. Is there anything I am doing wrong here? I am using SourceTree for Mac.
Asked
Active
Viewed 2,497 times
0
-
When you click on `Repository > Repository settings`, does it show two remotes on the "remote repository path" list? – everton Jun 14 '16 at 18:37
-
I am pretty new to git. Yes, it shows 2, because I added two. One for origin and one for bitbucket. When I push my changes I push them to all repositories. Still not 100% sure though if this is the proper way to do it. – Sonu Kapoor Jun 14 '16 at 19:04
-
What are the remote names shown on that screen? – everton Jun 14 '16 at 19:15
-
origin and bitbucket. – Sonu Kapoor Jun 14 '16 at 19:26
1 Answers
1
If you need to get two remotes in sync, the most common way to achieve that is to push your changes to both:
git commit -m <msg>
git push origin <branch>
git push bitbucket <branch>
On SourceTree:
Click on "Push"
Select the remote on the dropdown, then select which branch you want to push, and click on OK.
Repeat the process to the other remote.
Anternatives are:
- Setup multiple urls to a remote - This SO answer can give you details on this
- Setup commit hooks to automatically push commits to a secondary remote everytime push them into your default remote.