GitHub is a great place to host your public Git repos. But, if you want to create private repos you have to pay. This is where GitLab shines. They offer public or private repos completely FREE! But let’s be honest, not everyone knows how to use the Git commands or would like to constantly enter those pull/push commands. Personally, I really like the ease of use with the GitHub Windows client. So let’s get started setting up the client to work with our GitLab repos!
After you download and install the GitHub client and login to use it for some of your GitHub repos, your GitHub client will be automatically generating an ssh key for this client to use with your GitHub account. It is by default located in your “C:\Users\USERNAME\.ssh” directory.
Let’s open this .pub file with notepad and copy our public key to share with GitLab so we can access our repos on this computer.
OPTIONAL: You can open the GitHub shell and use the command “ssh-keygen -t rsa -b 4096 -C “firstname.lastname@example.org”” to generate a new key which will be placed in your “C:\Users\USERNAME\Documents\GitHub” directory.
Navigate your web browser to https://gitlab.com/profile/keys and paste your public key here. Give it any title you want, and press save. If all went well, you should see the screen below.
Now navigate your browser to https://gitlab.com/dashboard and browse to your repo. In your repo information you should see a URL with 2 buttons. Press the HTTPS button to switch the URL to an HTTPS URL. Make sure you have the GitHub client open as we will be highlighting and dragging this URL to our GitHub client.
Once you drop the URL, it will begin cloning the repo and it MIGHT ask you for a username/password, but it really shouldn’t as the GitHub key is being used to provide authentication.
You now have GitHub and GitLab repos all in 1 easy to use client!
Thanks for reading this article, and if you like this be sure to stop by again for more!