3 ms·
Now what I would really like to see is some tool for keeping my GitHub repos in sync with my GitLab ones. I did a one-time migration from GH to GL, but my GH a
by AdmiralAsshat 8y ago
Now what I would really like to see is some tool for keeping my GitHub repos in sync with my GitLab ones.
I did a one-time migration from GH to GL, but my GH account is still open, primarily because some projects are GH-only, meaning I might continue to make forks, contributions, etc.
Some way of making sure that I can periodically get all of those over to my GL would be nice.
- scrollaway 8y agoGitlab itself supports being a mirror of an upstream GitHub remote (or any remote). Last I checked it doesn't deal well with force pushes but I haven't checked in a long time.
- kbenson 8y agoNot that I'm all that good at the more esoteric features of git, but you can overwrite the history with the correct flags, right? It seems like all you would need to do to sync them is have the most recent checkout of each, a way to determine which was newer, and push the newer branch over the older one (to be simplistic and destructive). If you're always overwriting history of one to make it match the other, diffing the git logs of each against each other would likely tell you which had items the other didn't, and if it went just one direction or both (i.e. can you just overwrite one with the other or is some manual intervention required).
- MereInterest 8y agoThe git repo itself is the easy part. You just make a local clone with two remote repos, pull from one, and push to the other. The hard part is all the parts that aren't managed by git, the issue tracker, PRs, releases, etc.
- sytse 8y agoThanks for using GitLab! Please also see https://docs.gitlab.com/ee/workflow/repository_mirroring.html https://docs.gitlab.com/ee/workflow/repository_mirroring.htm... Pushing free to use, pulling is paid feature but public projects can use it for free too.
- cfstras 8y agoI‘m using the setup linked below to sync a few repos to gitlab. It uses GL pipelines to do the sync, and a webhook to do it instantly (however you can trigger pipelines using curl, or on a timer in GL) https://gist.github.com/cfstras/5e40ea264517552e29caf61bbd28daad https://gist.github.com/cfstras/5e40ea264517552e29caf61bbd28...
- anon4242 8y agoGit is after all designed for this distributed scenario, so you'd think it would be possible, what about something like: Setup: git add remote gitlab ... git add remote github ... Then whenever you need to sync: git fetch --all git checkout -b gh --track github/master git checkout --track gitlab/master git merge/rebase gh git push gitlab Could probably be done shorter but those steps should do it..
- johannes1234321 8y agoThis has the issue that you have to add this to your Workflow and nice wrappers have to be put on all workstations. A mirroring setup like provided in GitLab (see sibling post) takes that burden away.
- frutiger 8y agoCheck out the `--mirror` flag.