Compartmentalized Documented Extendible Reproducible Robust

GitLab to GitHub Migration

This if for migrating repos from one INTERNAL GitLab server to another. This is geared to RStudio users.

Although this is long, that is because I went into every single step in detail. It’s actually quite easy.

  1. Make the blank repo on
  2. In RStudio, update the .git/config file with the new github url
  3. Click Push

Let’s give the URL for the internal GitHub and GitLab the following names:

Obviously replace with the real URLs. It won’t be anything like that.

Initial set-up

  1. VPN into into your local network.
  2. Go to https://github.XYZ.local and login.
  3. In another tab on your browser, login to https://gitlab.XYZ.local

Make a blank repo on GitHub

  • Let’s say my repo on GitLab is TestPackage1.
  1. Look in upper right for the + sign. Click that and click New Repository.
  2. Give the new repo the same name as the GitLab repo. So I will call it TestPackage on github.nwfsc2.noaa.gov
  3. Click Create Repository. Private/Public doesn’t matter. DO NOT click the boxes to add a README or .gitignore!
  4. Ignore the page that comes up saying ‘Quick Set-up’ etc. Just stop there and go to the next step below.

Leave the browser and go to RStudio.

  1. Open up the project with the files that are in your GitLab repo. So I open my TestPackage project in RStudio.
    • Don’t have those files locally? See instructions below to get those to get a copy locally and as a project in RStudio.
  2. In RStudio, look for the ‘More’ cog in the Files pane, Click that and make sure is shows ‘Show Hidden Files’
  3. Open the .git folder in the Files pane. Click on ‘config’ to open that file.
  4. Look for the line that says ’url = https://gitlab.XYZ.local
  5. Change https://gitlab.XYZ.local to https://github.XYZ.local. Everything else stays the same.

So for me that line changes from

url = https://gitlab.XYZ.local/eholmes/TestPackage to

url = https://github.XYZ.local/eholmes/TestPackage

  1. Save.
  2. Click the Git tab (just above the File pane), and click the upward Green arrow.
  3. It’ll ask you for a password the first time you do this. You’ll see a pop-up window, but it won’t tell you that it is done.

Back to the GitHub server

Troubleshooting

Don’t have your GitLab repo on your computer?

  1. Copy the url of the repo. So like https://gitlab.XYZ.local/eholmes/TestPackage
  2. Open RStudio and click File > New Project > Version Control > Git and paste the URL into Repository URL.
    • Note give some thought to where you keep repos on your local computer. I keep all of mine in one folder called GitHub in my Documents folder. You might lose track of them if you don’t keep them in the same spot.
  3. Click Create Project

You have the GitLab repo on your computer but it is not an RStudio project.

  1. Open RStudio and click File > New Project > Existing Folder > Git and paste the URL into Repository URL.
  2. Click Create Project > Existing Directory then navigate to the folder with the repo on your computer.

When I click Push, I get an error that RStudio doesn’t know how to get my GitHub credentials. Sorry, that’s a pain. You need to tell RStudio how to get that info.

I got the error ‘Repo not found’ when I clicked push

I got an error saying cannot merge because of conflicting histories (or something like that)

  • You clicked the boxes and created a ReadME or .gitignore file when you created the repo on github.nwfsc2.noaa.gov.
  1. Go back to the repo on https://github.XYZ.local.
  2. Click Settings (nav bar just above the big green Code button)
  3. Scroll down and delete the repo
  4. Create it again and this time don’t click one of those check boxes that makes a Readme or .gitignore file

I did what you said but when I go to https://github.XYZ.local, I don’t see the files. It still shows the Quick Set-up instructions.

  • Refresh the page

NWFSC Math Bio Program