Skip to content

Commit 2ac057c

Browse files
committed
convert from gitLab to GitHub
1 parent 4c86c0a commit 2ac057c

File tree

178 files changed

+4319
-2504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+4319
-2504
lines changed

_handson_old.Rmd

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
---
2+
title: "Git Workshop - Hands-On"
3+
output: html_document
4+
---
5+
6+
```{r, message=FALSE, warning=FALSE, include=FALSE}
7+
library(tidyverse)
8+
library(DT)
9+
```
10+
11+
```{r loaddata, message=FALSE, warning=FALSE, include=FALSE}
12+
hubs <- read_csv("data/hubs.csv")
13+
```
14+
15+
### Generate SSH Keys
16+
17+
This must be done on each workstation you use to *push*.
18+
19+
- https://gitlab.oit.duke.edu/help/ssh/README
20+
21+
This step was covered in the [Outline Section](outline.html#generate_ssh_keys_in_advance_of_the_workshop)
22+
23+
## Make a Repository
24+
1. Duke's GitLab -- <a href="https://gitlab.oit.duke.edu" target="_blank">https://gitlab.oit.duke.edu</a>
25+
1. Duke Shibboleth Login
26+
1. New Project <br><figure>![](images/new_gitlab_project_button.png)</figure><br>
27+
1. Add a project name. Use the name *test-one* <br> <figure>![](images/project_name.png)<figcaption>replace 'my-awesome-project' with 'test-one'</figcaption></figure><br>
28+
29+
1. Create Project<br><figure>![](images/create_project.png)</figure><br>
30+
31+
- GitLab will present a new page. Notice the section below the *Command line instructions* header. That information can come in handy. For future repositories, you may want to make a note of those Git commands. We will not use those commands today so you can move on. <br>&nbsp;
32+
33+
1. Make a README file <br><figure>![](images/readme.png)
34+
<figcaption>Open in a new tab for each link: README, LICENSE, and .gitignore</figcaption></figure><br>
35+
36+
1. Make a top level heading with the word "README"
37+
38+
- i.e. type: `# README`
39+
- See [Markdown](markdown.html) for more information on Markdown tagging
40+
1. After a blank line type: `This is my first GitLab repository.`
41+
1. Commit changes
42+
43+
&nbsp;
44+
45+
46+
1. Make a license file (Open in a New Tab, click the LICENSE link) <br><figure>![](images/license.png)
47+
<figcaption>Appply a license format</figcaption></figure><br>
48+
49+
- choose *MIT* license, or paste a [Creative Commons](https://creativecommons.org/share-your-work/) License into license.md
50+
- Commit changes
51+
52+
&nbsp;
53+
54+
1. Make a .gitignore file (Open in a New Tab, click the .gitignore link)
55+
56+
1. *Apply a .gitignore format*
57+
58+
- choose *R*
59+
60+
1. Commit changes
61+
62+
1. Congratulations. You've just created your first GitLab repository. Click *test-one* in the top-left of your GitLab repo screen. Now you'll see your repository -- including the three files you just created.
63+
64+
&nbsp;
65+
66+
## Clone
67+
68+
**Using RStudio**, clone your repository. Cloning will pull down the whole repo to your local system -- including the three files you just created.
69+
70+
### Bring the repo down locally via RStudio
71+
72+
1. Copy GitLab repo URL to clipboard
73+
74+
- The repo should be at a location like this. `https://gitlab.oit.duke.edu/<<your-NetID>>/test-one`, copy the *git* URL to the clipboard by clicking the icon <br><figure>![](images/copy_repo.png)
75+
<figcaption>Copy the repo URL</figcaption></figure><br>
76+
77+
1. Launch RStudio and create a *New Project...*
78+
79+
1. From the RStudio menubar: *File > New Project...* > Version Control > Git <br><figure>![](images/project_version_git.png)<figcaption>Paste the GitLab repo URL (from the step above) into the *Repository URL:* field in RStudio</figcaption></figure><br>
80+
1. Create Project
81+
1. You may be prompted with a message which asks if you about the "authenticity of host". I like to verify the IP number is correct; then the answer is `yes`.<br><figure>![](images/yes.png)</figure><br>
82+
83+
&nbsp;
84+
85+
## Push: Edit and Commit
86+
87+
**Continue in RStudio**. This time you'll make local changes by editing your local repository. After saving the changes you'll *add* and *commit* the changes. Lastly, you will *push* your changes up to the remote repository.
88+
89+
<br><figure>![](images/push.png)</figure>
90+
91+
### Edit
92+
93+
1. In the Files Pane, Open the README.md file
94+
1. In the Editor Pane, modify your README with [Markdown](markdown.html)
95+
96+
- Make a Sub-heading with the word "Purpose"
97+
98+
- i.e. `## Purpose`
99+
100+
- After a blank line type: `This is my first Git repository. I'm going to push this file to GitLab via RStudio. Hello World.`
101+
1. Save the changes to this file
102+
103+
104+
### Commit & Push
105+
106+
1. In the Git pane:
107+
108+
1. Check each of the staged files
109+
1. Click *commit* and provide a message: `this is my first edit of a README and supporting files`
110+
1. Click the *commit* button to engage your commit process with the message, then close
111+
1. Click the *Push* arrow, then close, then close the commit dialogue box
112+
<br><figure>![](images/commit_push.png)</figure><br>
113+
114+
1. View your changes back at GitLab: `https://gitlab.oit.duke.edu/<<your-NetID>>/test-one`
115+
116+
&nbsp;
117+
118+
## Pull
119+
120+
The next time you open your project in RStudio the first step you should take is to *Pull* from the GitLab repo. Then make your changes, then commit and push. If you forget to *Pull* you may have to resolve some conflicts. For best results, get into the habit of pulling before you make edits.
121+
122+
<br><figure>![](images/git_push_pull.png)</figure>
123+
124+
## Public or Private Repositories
125+
126+
- `https://gitlab.oit.duke.edu/<<your-NetID>>/test-one` > Settings > Scroll to *Project Visibility* > right-hand drop-down list: Private | Public
127+
- Add a Description (Optional)
128+
- Add Tags (Optional)
129+
130+
&nbsp;
131+
132+
## Public Hubs v Duke's Hub
133+
134+
```{r, echo=FALSE, message=FALSE, warning=FALSE}
135+
datatable(hubs, rownames = FALSE, options = list(dom = 't'),
136+
escape = FALSE) %>%
137+
formatStyle("Duke's GitLab", color = "silver", backgroundColor = "navy", fontWeight = "bold") %>%
138+
formatStyle("Public Hubs", backgroundColor = "lightblue")
139+
```
140+
141+
142+
&nbsp;
143+
144+
&nbsp;

_outline_old.Rmd

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: "Git & R/RStudio Prerequisites: Software Installation"
3+
output: html_document
4+
---
5+
6+
## Hands-on Outline
7+
8+
1. Git
9+
1. GitHub and GitLab and Bitbucket
10+
11+
- Duke's GitLab
12+
13+
1. Markdown
14+
1. Orchestrating with RStudio
15+
16+
- Masks the CLI
17+
- Easier to get started
18+
- Power Users can still use commands
19+
20+
## Prerequisites
21+
22+
### Load & Install Software **Before the Workshop**
23+
24+
To complete the hands-on portion of the workshop you'll need software pre-installed. Due to the nature of the workshop we will not have time to troubleshoot installations during the workshop. Please be sure to perform the following steps **on the laptop you bring to the workshop**.
25+
26+
### Required Software
27+
28+
#### Download and install
29+
30+
I recommend accepting the install defaults for the following:
31+
32+
- **Git**: <a href="https://git-scm.com/downloads" target="_blank">https://git-scm.com/downloads</a>
33+
34+
1. Download and install Git
35+
1. Run the install and accept all the defaults
36+
37+
<br><figure>![](images/git_os.png)<figcaption>Click on the link to your OS</figcaption></figure><br>
38+
39+
- **R**: <a href="http://archive.linux.duke.edu/cran/"" target="_blank">http://archive.linux.duke.edu/cran/</a>
40+
41+
- If you have not installed R before choose *install R for the first time*
42+
- If you already have R installed on your workstation I recommend running the latest version, but any reasonably current version should be fine.
43+
44+
- **RStudio**: <a href="https://www.rstudio.com/products/rstudio/download/#download" target="_blank">https://www.rstudio.com/products/rstudio/download/#download</a>
45+
46+
<br><figure>![](images/rstudio_download.png)</figure><br>
47+
48+
49+
If you haven't yet, install each of the above applications.
50+
51+
52+
### **Duke's** GitLab -- Verify *your NetID* Access
53+
54+
During the workshop we will use <a href="https://gitlab.oit.duke.edu" target="_blank">Duke's GitLab</a>. To complete the hands-on portion of the workshop, you **must log-in** -- **in advance** of the workshop -- and ensure you have NetID access to <a href="https://gitlab.oit.duke.edu" target="_blank"> https://gitlab.oit.duke.edu</a>. If you do not have access to **Duke's** GitLab, [contact OIT](https://oit.duke.edu/help).
55+
56+
- Be certain you log-in via "Duke Shibboleth Login" using your NetID
57+
58+
<br><figure>![](images/gitlab_shib_login.png)</figure><br>
59+
60+
### Generate SSH keys in Advance of the Workshop
61+
62+
I recommend generating your SSH keys in advance of the workshop. Then add your public key to Duke's GitLab. To do so, you should have already installed Git to your laptop.
63+
64+
We will cover key configuration in the workshop although you will find the explanation easier to follow if you generate and add your keys in advance. The instructions below are based on those found at Duke's GitLab. If the instructions below are not clear you should consult the more complete [GitLab instructions](https://gitlab.oit.duke.edu/help/ssh/README)
65+
66+
1. To begin, open the **Terminal** *in RStudio*. If you're using the latest version of RStudio, the *Terminal* is a tab in the console quadrant (typically the bottom-left)
67+
68+
- In RStudio: Menubar `Tools > Terminal > New Terminal`
69+
70+
<br><figure>![](images/shell.png)</figure><br>
71+
72+
73+
2. Determine if you already have an SSH key pair. In the *Termnal* tab, type: `cat ~/.ssh/id_rsa.pub`
74+
75+
- If you see a string starting with `ssh-rsa` you already have an SSH key pair and can simply copy that key (Step 5)
76+
77+
- If you get some kind of error, you'll have to generate a key in the next step (Step 3)
78+
79+
1. In the *Terminal* tab, type: `ssh-keygen -t rsa -C "[email protected]" -b 4096`
80+
81+
- Use your Duke Email address
82+
83+
1. You will be prompted to input a file path. i.e. the location where you'll save your SSH key pair.
84+
85+
- If you don't already have an SSH key pair use the suggested path by pressing enter
86+
87+
- After setting the file path you will be prompted to input a password. This will secure your SSH key pair. It is a best practice to use a password for an SSH key pair, but it is not required. You can skip creating a password by pressing enter
88+
89+
- **Note**: If you want to change the password of your SSH key pair, you can use `ssh-keygen -p <keyname>`
90+
91+
1. Copy the public SSH key to the clipboard buffer
92+
93+
- In the *Termnal* tab, type the appropriate code below:
94+
- **macOS**: `cat ~/.ssh/id_rsa.pub | pbcopy`
95+
- **Windows**: `cat ~/.ssh/id_rsa.pub | clip`
96+
97+
1. The final step is to add your public SSH key to GitLab.
98+
99+
- Navigate to the *SSH Keys* tab in your *Profile Settings.* Paste your key in the *Key* section and give it a relevant *Title*. Use an identifiable title like *Work Laptop - Windows 7* or *Home MacBook Pro 15.*
100+
101+
- If you manually copied your public SSH key make sure you copied the entire key starting with `ssh-rsa` and ending with your email.

docs/README.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@
8181
.tabbed-pane {
8282
padding-top: 12px;
8383
}
84+
.html-widget {
85+
margin-bottom: 20px;
86+
}
8487
button.code-folding-btn:focus {
8588
outline: none;
8689
}

0 commit comments

Comments
 (0)