On-premise Gitlab to GitHub Mirroring

Md RaselMd Rasel
1 min read

The article is to create a mirror between gitlab and github. You can create mirror on github from your on-premise gitlab repo when a push events is happen. Let’s check the step-by-step solution.

  1. Create a GitHub repository as per your gitlab repo name or any.

    Go to your GitHub Settings → Developer Settings → GitHub Apps → Personal Access Token → Token Classic → Generate new

    Preserve the access token on a text editor or on a file; you will need this token for further use.

  2. Now Go to your Gitlab project repo, which you want to mirror on Gitlab. Open the repo and go to settings → Repository → Mirror repositories

    Put your Git repository url and username with the token on GIt repository URL like below

     https://<GitHub_username>:<GitHub_token>@github.com/MdRasel0/hello-world.git
    

    Choose the Mirror Direction Push and Put Your Access Token on the password field of Gitlab mirror.

    For testing whether the mirror is working or not, just click the below arrowed button.

    If all goes okay,, you will get your full Gitlab repo on GitHub with all the Branches.

That’s all you have to do to clone or mirror your Gitlab repo to GitHub repo.

1
Subscribe to my newsletter

Read articles from Md Rasel directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Md Rasel
Md Rasel