ryanpcmcquen / github_to_gitlab_syncer

Sync all your GitHubs to GitLab.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

github_to_gitlab_syncer

Sync all your GitHubs to GitLab.

This now requires a premium plan.

Hey there!

Maybe you are like me, and are weary of where GitHub is headed, but cannot completely divest, since having a GitHub account has many perks (it is nearly essential for logging in to/using some really nifty dev tools). It is also a great place for people to discover your work. BUT, since GitLab has some incredible mirroring options, you may as well stick all your work over there, and give anyone else weary of GitHub a 'second option' for enjoying your work. This set of simple scripts will allow you to do just that.

The first script you should start with, is SYNC_ANY_GITHUBS_NOT_ON_GITLAB.js, once you fill in your .SECRETS file, run:

node SYNC_ANY_GITHUBS_NOT_ON_GITLAB.js

The script will compare what you have on GitHub and GitLab, and sync anything not on GitLab from GitHub. It even does some name sanitation, as GitLab's GUI import process will occasionally take some liberties with naming.


Oh, and if you plan to have GitHub be your 'source of truth', you should also run this:

node FIX_MIRROR_SETTINGS_FOR_ALL_GITLABS.js

This will change the mirror_overwrites_diverged_branches setting to true for all your GitLab repos, meaning if things get borked, they get overwritten from GitHub.

And that .SECRETS thing should look kinda like this:

module.exports = {
    gitHubToken: "LONG_ASS_TOKEN",
    gitLabToken: "NOT_AS_LONG_OF_A_TOKEN",
    gitHubUser: "YOUR_NAME_BRO",
    gitLabUser: "YOUR_NAME_BRA",
};

⚠️ DANGER ZONE ⚠️

If you haven't kept GitLab clean, you can start with a blank slate, by running:

node DELETE_ALL_GITLAB_REPOS.js

WARNING, this will delete everything there, so please, USE IT AT YOUR OWN RISK!

Well, actually it will delete a page worth of repos at a time, which means about 30 at a time. So you'll have to run it multiple times to delete everything. This is by design in case you run it on accident. The other scripts recurse to cover all of your repos/projects.

About

Sync all your GitHubs to GitLab.

License:Mozilla Public License 2.0


Languages

Language:JavaScript 97.6%Language:Shell 2.4%