vkaul11
vkaul11

Reputation: 4214

best way to synch two remote repositories in GIT

We have one internal remote repository in stash and one repository in github for our third party consultants. We try to synch the repository in "Atlassian Stash" to the repository in GitHub everyday. The procedure I follow is to change the remote to github using set url and pull from github (the branch I desire) to my local directory and then I change the remote again to "stash" and push the changes there from my local directory. Is this a good approach or there is a better way to do it?

Upvotes: 3

Views: 747

Answers (2)

talles
talles

Reputation: 15144

You can use a hook for that.

You may push to the second repo when the first one triggers post-receive

Upvotes: 1

gcbenison
gcbenison

Reputation: 11963

As @g19fanatic says, no need to keep changing the remote URL's. Just

git pull <name of stash remote>
git push <name of github remote>

You need two separate remotes for this; add the second one if needed with git remote add

Upvotes: 1

Related Questions