• 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.

Rahul Mohan February 25, 2014

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
Answer accepted
Rahul Mohan March 17, 2014

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.

0 votes
William Crighton _CCC_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 1, 2014

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

Rahul Mohan July 1, 2014

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..

William Crighton _CCC_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 1, 2014

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.

0 votes
Rahul Mohan March 11, 2014

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.

0 votes
Rahul Mohan February 26, 2014

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.

0 votes
cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 26, 2014

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

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 26, 2014

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

Rahul Mohan February 26, 2014

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 ?

0 votes
Rahul Mohan February 25, 2014

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events