• Community
  • Products
  • Bitbucket
  • Questions
  • Github repo migrated to STASH. Want to sync the Github repo with the STASH repo on a daily basis as few developers are still on github and modifying code there.

Github repo migrated to STASH. Want to sync the Github repo with the STASH repo on a daily basis as few developers are still on github and modifying code there.

I migrated all my repo(S) from GIthub to STASH. Still some of the developers are working in Github. Is there a way to have my Github repo synced onto the migrated STASH repo on a daily basis .

6 answers

1 accepted

1 vote
Accepted answer

i got the daiyl update feature fixed by writing a script which will fetch from origin[github] and then push all the changes to stash.

please provide your suggestions as i have no clue whether this can be done.

Hi Rahul,

Depends on what you mean by 'synced'? Because this is Git/DVCS you could easy set up a CI build (eg. Bamboo, Jenkins, etc) that regularly pulls from Github and pushes to Stash.

However, if you're modifying both repositories at the same time then things get tricky. At this point your build will need to merge all branches (one at a time) that are being updated, and then fail if there are any merge conflicts. These merge conflicts will also get more severe as time goes on unless you push the merges back to both repositories. I would highly recommend for each repository you only have one writable copy, either in Stash or Github

Does that make sense? You might be interested in this feature request:

https://jira.atlassian.com/browse/STASH-2714

Charles

Hi Rahul,

That's good to hear - it makes things much easier.

Basically a 'git clone --mirror $GITHUB && git remote add --mirror=push stash $STASH && git push stash' or thereabouts should work. Please test first of course - be a little careful with mirror as it can override all of your refs in a single push.

Cheers,

Charles

only the github would be modified. the stash repo will be untouched. So how can i basically do that ? would git pull and git push --all stash work here ?

thanks for warning me :-) . but i am taking care of that...

also i got the daiyl update feature fixed by writing a script which will fetch from origin[github] and then push all the changes to stash.

also i got the daiyl update feature fixed by writing a script which will fetch from origin[github] and then push all the changes to stash.

Rahul,

There's a plugin in the marketplace - free - that is will execute push's against repo's. You can read more about it here:

https://github.com/englishtown/stash-hook-mirror/wiki

hi William thanks for the answer, but i have already figured out a way of mirroring the rpeo and have scripted that and got it working..

Rahul,

I added that comment more for people who find your question/answer while looking for how to sync 2 stash instances, as I am, than any other reason. These questions/answers are perpetual....and if you're lucky (or not) you'll find this post 10 years from now b/c you're having to lookup how to do something you've long forgotten...I know I have several times. I laugh at the posts I was making back in 2004.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

211 views 3 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you