This repository was archived by the owner on Sep 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path2019-10-15_setup.Rmd
129 lines (74 loc) · 3.1 KB
/
2019-10-15_setup.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# 2019-10-15: Setup GitHub, R, RStudio, Git
Based on [Happy Git and GitHub for the useR, by Jenny Bryan, the STAT 545 TAs, and Jim Hester](https://happygitwithr.com/).
## Register a free GitHub account
* Your username should be timeless, so you accumulate credit (exclude your employer; add your work email to your personal account).
* Your GitHub username, and definiterly your profile, should have your name.

This makes it easy for people to search your name and find your username. People need your username to `@mention` you on GitHub (e.g. to thank you or discuss issues).

## Install or update R and RStudio AND Install Git
How to (a) [think](https://happygitwithr.com/install-r-rstudio.html#install-r-rstudio)
(b) [about](https://community.rstudio.com/t/should-i-update-all-my-r-packages-frequently-yes-no-why/5856/4?u=mauro_lepore) (c) [upgrading software](https://cran.r-project.org/web/packages/installr/index.html).

> __If it hurts so it more often__. If you have this kind of exponential relationship, then if you do it more frequently, you can drastically reduce the pain.
>
> -- Martin Fowler in [FrequencyReducesDifficulty](https://martinfowler.com/bliki/FrequencyReducesDifficulty.html)
## Introduce yourself to Git (TODO)
```
# My ~/.gitconfig at the start
git config --global --list
#Email associated with GitHub
git config --global user.email "[email protected]"
git config --global user.name "Mauro Lepore"
# Other very useful configurations
git config --global push.default "current"
git config --global core.editor "notepad"
git config --global credential.helper "manager"
# My ~/.gitconfig at the end
git config --global --list
```
## Prove local Git can talk to GitHub (SKIP)
Login to http://github.com/
On GitHub:
* Create a repo
* Add description.
* Add README.md
* Copy https clone link
On Git Bash:
```
# Clone new repo and move to it
git clone <URL>
cd <new repo>
# Edit README
## Before
cat README.md
echo "A line from local computer" >> README.md
## After
cat README.md
# Commit and push
git add .
git commit -m "Edit README from local computer"
git push
```
* Check if credentials are managed correctly: Repeat edit, commit and push (you should no longer be challenged for a username and password).
## Cache your username and password or set up SSH keys (DONE)
We should be done. We already added this:
```
git config —global credential.helper manager
```
If we need to remove your git credentials on Windows, they are here:
_Control Panel > user accounts > credential manager > Windows credentials > Generic credentials_
SSH: Skip.
## Prove RStudio can find local Git (TODO)
Login to http://github.com/
On GitHub:
* Create a repo
* Add description.
* Add README.md
* Copy https clone link
On RStudio:
File > New Project ... > Version Control > Git
Edit README, commit and push.
Do it twice to confirm that the credential manager works as expected.
## Contemplate if you’d like to install an optional Git client
I recommend GitKraken: https://www.gitkraken.com/download