forked from RVerse-Tutorials/RWorkflow-NWFSC-2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitlab-to-github.Rmd
118 lines (77 loc) · 4.83 KB
/
gitlab-to-github.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
title: "Migrating from GitLab to GitHub"
output:
html_document:
toc: true
include:
after_body: footer.html
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r echo=FALSE, message=FALSE, warning=FALSE}
library(kableExtra)
dt <- data.frame("Compartmentalized", "Documented", "Extendible", "Reproducible", "Robust")
kable(dt, col.names=NULL) %>%
kable_styling(full_width = TRUE) %>%
row_spec(1, bold = FALSE, color = "white", background = "blue") %>%
column_spec(column = 1:5, width = "20%")
```
# 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:
* Internal GitHub URL: https://github.XYZ.local
* Internal GitLab URL: https://gitlab.XYZ.local
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
6. Save.
7. Click the Git tab (just above the File pane), and click the upward Green arrow.
8. 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
* Go back to the browser to https://github.XYZ.local and refresh the page. Voila your files are there.
## 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.
* https://rverse-tutorials.github.io/RWorkflow-NWFSC-2020/set-up.html#Set_up_RStudio_to_use_Git
### I got the error 'Repo not found' when I clicked push
* Either you misspelled the url in the .git/config file or you forgot to make the repo on https://github.XYZ.local
### 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
### More help on working with GitHub is here
* https://rverse-tutorials.github.io/RWorkflow-NWFSC-2020/week1-rstudio.html#Git_(GitHubGitLab)