Friday, September 6, 2013

Sync local git repository with remotes github and bitbucket

It is common case when you need sync sources between few remote repositories of git, mostly one of them is backup mirror or you have two communities and do not want to bother them what is better github or bitbucket.

#recheck what remotes you have already
git remote

# add link to github and bitbucket remote repo
git remote add github git@hithub.com:my-repo-name.git
git remote add bitbucket https://bitbucket.org/user/my-repo-name
git push -u github master
git push -u bitbucket master

#Somebody sent you fixes to bitbucket rep - pull it from bitbucket and push github
git pull bitbucket
git push github

No comments:

Post a Comment