1

I'm new to git and trying to figure out the best way to copy an existing GitHub.com repository owned by another user to a private git server I have on Atlassian Stash. Ideally we could do a copy at least once a month.

The tedious method I'm doing right now is cloning the GitHub.com repository to a private workstation and then adding a remote to an empty repository in Atlassian Stash and pushing it. This isn't a big deal for one repository, but we have at least a couple dozen we'd like to copy.

From what I've understood I as an owner can setup remotes for a repository to push changes to multiple locations, but I haven't figured out how as a non-owner to pull a repository. There are two plugins available in the Atlassian community and both seem to only offer pushing of repositories to remotes, and not pulling as I need.

fourg
  • 13
  • 2
  • 1
    Couldn't you just set up a cron job to pull and then push? – Dietrich Epp May 15 '14 at 18:43
  • In your tedious method, after you push to 'Atlassian Stash' what do you then do with that repository? How is that repository used in ongoing development by you and/or your team? – GoZoner May 15 '14 at 22:21
  • @GoZoner it is simply being copied to archive, no ongoing development being done on it on our private git server – fourg May 16 '14 at 15:42

1 Answers1

1

If you are creating empty repositories under 'Atlassian Stash' and pushing into them the GitHub.com local clone that you made, then what could developers be using a new repository for every month or so? Sounds like the overall development process isn't working...

Have a single central repository that your developers clone from and deliver their work to. In that central repository have a branch that tracks one or more branches at the remote, GitHub.com repository. You update those remote branches as often as you want by simply using git pull. Then, every so often, so as not to upset the work of everybody on your team, you carefully merge the remotes into your development branch. Then you team pulls the updated development branch and continues working.

[EDIT]

The process that you are following (cloning GitHub, pushing to an empty Atlassian Stash repository) appears to be exactly as described in Atlassian Documentation for 'Importing Code from an Existing Project'.

I think you have a couple of options:

  1. Since you need to clone GitHub anyway, have the clone serve as the archive - that is skip Stash altogether. Each month you'll end up with a new repository for each project.
  2. Git repositories keep detailed change history (which is the point of a software CM system) so you don't need multiple archives, every month, just pull each month and add your own tag. This won't work if you suspect that original repo owner is making destructive changes.
  3. Setup a cron script.
GoZoner
  • 67,920
  • 20
  • 95
  • 145
  • The copy we are making is not intended to be used in development. We have collaborations ongoing with various partners who keep their code in GitHub and we would like to have a private copy of these repositories for archive purposes. – fourg May 16 '14 at 15:46
  • 1
    Stash developer here. I haven't seen a plugin for that purpose (as you say they're all push-based mirrors). I might recommend/expand on point 3 above - you can also use your CI server (eg. Bamboo, Jenkins) to pull from GH and push to Stash. Good luck. – charleso May 17 '14 at 10:05