Skip to content

ireshkanashetti/mirror-repo-github-gitlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Repository Mirroring (From GitLab To GitHub)

Overview:

Repository mirroring helps you keep two repositories in sync — for example, whenever you push changes to GitLab, they can automatically appear in GitHub.

It’s especially helpful for:

  • Creating backups of your GitLab repository on GitHub.
  • Working together across multiple platforms.
  • Maintaining both public and private versions of the same project.
  • Automating updates so both repositories always stay up to date.

Step-1: Create Repository in GitHub:

Create a repository with README.md file

Step-2: Create Personal Access Token(classic):

GitHub → Settings → Developer settings → Personal access tokens → Generate new token.

Grant all permissions/Scopes:

Step-3: Create Repository in GitLab:

Create a Blank repository with README.md file:

Step-4: Create a mirroring Repository:

Set up your project to automatically push or pull changes to/from another repository. Branches, tags, and commits will be synced automatically.

Open your project → Settings → Repository → Mirroring repositories. Click ** mirror repository**. For Git repository URL use the HTTPS push URL in this form:

(https://github.com/ireshkanashetti/mirror-repo-github)

When prompted for a password, paste the GitHub access token and save.

Step-5: Clone GitLab Repository in your machine, add files and push to server:

Open git bash and Clone repository

(https://gitlab.com/ireshkanashetti/mirror-repo-gitlab)

cd to repository

cd <Repository_Name>

Create a file(index.html)

nano index.html

Add File Containt

This file is pushed to GitLab

commit and push to GitLab Server

git add index.html

git commit -m "message"

git push -u origin main

OutPut:

GitLab:

GitHub:

Automatically index.html file is synchronized to GitHub repository.

Conclusion:

  • By completing these steps, you can successfully mirror your GitLab repository to GitHub, keeping your codebase synced, backed up, and accessible on both platforms.

  • This setup ensures a consistent workflow, encourages team collaboration, and provides extra reliability for your projects.

  • Using GitLab’s push mirroring, the process stays automatic, secure, and time-saving, ensuring your repositories remain up to date at all times.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published