If you're a GitLab user, you should consider mirroring your repositories to a remote location.
You never know what might happen. You've spent months on your code, housing it in GitLab. And then, out of nowhere, everything is gone. Chances are you have a clone of that code somewhere, but why leave it to chance, when you could use the GitLab built-in repository mirroring tool?
That's right. GitLab includes the ability to create remote mirrors for your repositories. With this tool, you can mirror your work to any remote repository that is accessible to the outside world.
I'm going to show you how to mirror a GitLab repository to a GitHub repository. You'll be surprised at how easy this is.
SEE: The top 10 languages for machine learning hosted on GitHub (free PDF) (TechRepublic)
What you'll need
The only things you'll need are:
A GitLab account with a repository to clone
A GitHub account with a repository that can be used to house the clone
How to create the mirror
Log into your GitLab account and click Projects in the upper left corner. From the drop-down, select Your Projects. In the resulting window, click the project you want to mirror. In the project's left sidebar, click the Settings and then select Repository (Figure A).
In the resulting window, click the Expand button associated with Mirroring repositories. In this new window (Figure B), you must enter the URL for the remote GitHub repository in the form of:
Where USERNAME is the name of your GitHub user and REPOSITORY is the name of the remote repository to house the mirror.
In the Mirror direction, select Push, and in the password section, select Password. Type the password for your GitHub user and then click Mirror Repository. Your mirror configuration is now saved and will appear below the configuration section (Figure C).
If you click the Sync button (the button directly to the left of the trashcan), the mirror will sync. Depending on how much code you have in the repository, this can take some time. If all has been set up correctly, you should see no errors and your GitLab repository has been successfully mirrored to GitHub.
And that's all there is to setting up a repository mirror from GitLab to GitHub. If you house your code on this service, you owe it to yourself (and all the hard work you've put in) to have numerous copies of that code. Gitlab makes this both possible and easy.
- How to become a software engineer: A cheat sheet (TechRepublic)
- Choosing your Windows 7 exit strategy: Four options (TechRepublic Premium)
- How to install and use git-secret (TechRepublic)
- How to use GitHub in Chrome OS (TechRepublic)
- How to install GitBucket on Ubuntu Server 18.04 (TechRepublic)
- How to add GitHub support to Jenkins (TechRepublic)
- GitHub: We're storing your open-source code in the frozen Arctic for 1,000 years (ZDNet)
- It takes work to keep your data private online. These apps can help (CNET)
- Must-read coverage: Programming languages and developer career resources (TechRepublic on Flipboard)