Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to sync from GitHub to Stash?

shaulbehr May 6, 2015

We've made the decision to migrate from GitHub to stash.

Using the instructions by Semyon Vadishev here, I managed to copy across the whole repository, including all branches and commits.  Great!  So now I've configured the new repository, but while I've been doing this, some 20+ developers have continued writing code and pushing to GitHub, so already my new repository is out of sync.

Now I've sent out an email to all developers putting them on notice that all their work must be committed and pushed to GitHub by the end of today, and tomorrow morning we'll make the switch.

But how do I sync these last few commits to Stash now?  Or do I have to wipe out my Stash repository and rerun that whole process again?  (Hint: the first option is very much preferable.)

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

5 votes
Answer accepted
Tim Crall
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.
May 6, 2015
git clone --mirror <github_url>
cd <reponame>.git
git remote add stash <stash_url>
git push --all stash
git push --tags stash

 


spankr May 7, 2015

[StackOverflow](http://stackoverflow.com/questions/5552879/synchronize-between-2-git-repositories) discusses this question as its a question for Git and not necessarily Stash.

0 votes
ThiagoBomfim
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 10, 2015

You need to mirror the repository.

This is documented here. From your description, you can skip step 5 and all the updates should be done.

0 votes
Peter Van de Voorde
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 6, 2015

Hi Shaul,

You should be able to do something like this:

  1. Checkout your stash repository to your local repository
  2. Change the remote to your github repository
  3. Pull all changes to your local repository
  4. Change the remote back to your stash repository
  5. Push all changes to the remote repository.

Best regards,

Peter

shaulbehr May 6, 2015

Hi Peter, I'm fairly new to Git, so pardon my ignorance, but if I pull (step 3), won't that just get my current branch? How do I make sure that I have everything from all branches?

Peter Van de Voorde
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 6, 2015

True, you would indeed need to checkout each branch seperatly (you can get the name of all branches using the git branch -a command). Maybe you could actually do the following: # checkout the github repo locally # change the remote to your stash repository # do a git push origin -all Best regards, Peter

TAGS
AUG Leaders

Atlassian Community Events