@@ -27,6 +27,8 @@ language: R
27
27
28
28
>
29
29
> **Live coding demo and assignment are intertwined and designed to work in order.**
30
+ > **Instructions for both Posit Cloud & RStudio are included so just use the setup pieces that fit your class.**
31
+ > **Sign into GitHub**
30
32
31
33
# # Introduction
32
34
@@ -55,6 +57,14 @@ data files and code in a more manageable way.
55
57
56
58
# # Version control using Git & RStudio
57
59
60
+ # ## Connecting Posit Cloud to GitHub (only if teaching in Posit Cloud)
61
+
62
+ 1. Go to https://login.posit.cloud/ (login in necessary)
63
+ 2. Click `Posit User Settings`
64
+ 3. Go to GitHub section and click `Private repo access also enabled`
65
+ 4. Will be redirected to GitHub to authorize Posit Cloud
66
+ 5. Click `Authorize posit-hosted`
67
+
58
68
# ## Create a Git repo
59
69
60
70
1. Navigate to Github in a web browser and login.
@@ -65,22 +75,31 @@ data files and code in a more manageable way.
65
75
5. Select `Private`.
66
76
6. Select `Initialize this repository with a README`.
67
77
7. Click `Create Repository`.
78
+ 8. From new GitHub repository, click green `Code` button ->
79
+ Click the `Copy url to clipboard` button.
80
+
81
+ # ## Connect to the Git repo
82
+
83
+ # ### Posit Cloud
84
+
85
+ 1. Posit Cloud (in class org) : New Project -> New Project from Git Repo
86
+ 2. Paste copied URL in `URL of your Git Repository:`.
87
+ 3. Click `OK`.
88
+ 4. Check to make sure you have a `Git` tab in the upper right window.
68
89
69
- # ## Connect to the Git repo in RStudio
90
+ # ### RStudio
70
91
71
- 1. From new GitHub repository, click green `Clone or download` button ->
72
- Click the `Copy to clipboard` button.
73
- 2. In RStudio, File -> New Project -> Version Control -> Git
74
- 3. Paste copied URL in `Repository URL:`.
75
- 4. Leave `Project directory name:` blank; automatically given repo name.
76
- 5. Choose where to `Create project as subdirectory of:`.
77
- 6. Click `Create Project`.
78
- 7. Check to make sure you have a `Git` tab in the upper right window.
92
+ 1. RStudio, File -> New Project -> Version Control -> Git
93
+ 2. Paste copied URL in `Repository URL:`.
94
+ 3. Leave `Project directory name:` blank; automatically given repo name.
95
+ 4. Choose where to `Create project as subdirectory of:`.
96
+ 5. Click `Create Project`.
97
+ 6. Check to make sure you have a `Git` tab in the upper right window.
79
98
80
99
# ## Install
81
100
82
101
` ` ` r
83
- install.packages(c('dplyr', 'usethis', 'gitcreds'))
102
+ install.packages(c('dplyr', 'readr', ' usethis', 'gitcreds'))
84
103
` ` `
85
104
86
105
# ## Introduce yourself to Git
@@ -111,7 +130,7 @@ use_git_config(user.name = "[name]", user.email = "[email]")
111
130
* `Add fish size and growth rate data`
112
131
* History:
113
132
* One commit
114
- * Changes too large to see
133
+ * Shows that the file has been added to version control
115
134
116
135
# ### Commit R script
117
136
@@ -122,8 +141,11 @@ library(dplyr)
122
141
library(readr)
123
142
124
143
fish_data = read_csv("Gaeta_etal_CLC_data.csv")
144
+
125
145
` ` `
126
146
147
+ **Make sure to have a new line at the end for a clean diff**
148
+
127
149
* Save as `fish-analysis.R`.
128
150
* Git -> Select `fish-analysis.R`.
129
151
* Changes in staged files will be included in next commit.
@@ -242,7 +264,7 @@ fish_data_cat = fish_data %>%
242
264
* By far the most popular hosted version control site
243
265
* Public and private hosted repositories
244
266
* Private free for students and academics
245
- * https://education.github.com/
267
+ * https://education.github.com/
246
268
* For the assignment, we're using private repositories that we made at
247
269
the beginning.
248
270
@@ -258,6 +280,8 @@ fish_data_cat = fish_data %>%
258
280
usethis::create_github_token()
259
281
` ` `
260
282
283
+ * You may need to allow popups and try again
284
+
261
285
* Select defaults
262
286
* Create token
263
287
* Copy token
@@ -400,5 +424,3 @@ mutate(length_cat = ifelse(length > 250, "large", "small"))
400
424
401
425
> Show an [example of a working repository]({{ site.github.repo }}) with
402
426
> branches and forks. Navigate to pull requests.
403
-
404
-
0 commit comments