-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGit_Create_User.Rmd
94 lines (63 loc) · 5.55 KB
/
Git_Create_User.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
---
title: "Getting Git"
output:
word_document:
toc: yes
md_document:
variant: markdown_github
html_notebook:
includes:
after_body: footer.html
toc: yes
highlight: pygments
html_document:
toc: yes
df_print: paged
pdf_document:
toc: yes
---
<style>
kbd { background-color:#32a848; }</style>
## Important!
Before you can install Git, you need to get a **temporary administrator password** from IT. So if you haven't done that already, write to *[email protected]* and ask them politely to give you this!
## Introduction
When we talk about Git, we usually mean the combination of two things: (1) The *program* Git, which you have to install on your computer, and (2) a **user account at Github** (or another website) for hosting projects that use git. (There are several alternatives to Github, such as BitBucket, GitLab, GitBucket etc., but here at NIVA we use Github.) So, while many confuse the two, Github and Git is not the same thing. When we store our projects in Github with RStudio, RStudio uses the Git program "under the hood".
We suggest that you start by setting up your Github account, and then install Git. Installing Git is not straightforward, but remember that it is [half the battle](https://happygitwithr.com/install-intro.html) - once it is installed and works, using it is easy and can usually be done by "point and click" in RStudio!
## Account Setup and Configuration
* The first thing you need to do is set up a free user account. Visit https://github.com. Provide an email address and click the big green <p><kbd>Sign up for GitHub</kbd> button.</p>
![](images/GitHub_Page.png)
* Then follow the instructions to create a password and username. **When choosing an username, we highly recommend taking a look at the [Chapter 4 (Register a GitHub account)](https://happygitwithr.com/github-acct.html) of Jenny Bryan’s [Happy Git and GitHub for the useR (happygitwithr.com)](happygitwithr.com).**
After a couple of extra steps you will have created an account.
* In will then get the following page:
![](images/GitHub_Team.png)
* You can skip the questions and go directly to **`Continue`** On the next page you can choose
**`Collaborative coding`**.
![](images/GitHub_Features.png)
* Next choose the free version. Annnnd... **voilà! You now have a Github account!**
![](images/GitHubNewAccount.png)
## Installing Git
* To install most programs at your NIVA computer you need administrative rights. To get that you need contact it-vakt ([email protected]) and ask for administrative rights to your computer. You will shortly get an email with the username and password you need for installation.
* If you are a Windows user, go to the [Git for Windows](https://gitforwindows.org/) web site and click the Download button. Make sure you notice *where* on the computer you download it to (for instance the 'Downloads' folder). When downloading has finished, go to the file (`Git-2.33.0.2-64-bit.exe`), *right-click* and select "Run as Administrator".
* For choices during installation and setting up Git, we suggest that you follow the instructions in [Chapter 6 and 7]( https://happygitwithr.com/install-git.html) of Jenny Bryan’s [Happy Git and GitHub for the useR (happygitwithr.com)](happygitwithr.com).
* Mac and Linux users can also find good guidance in [happygitwithr.com](happygitwithr.com).
* We ([Viviane](mailto:[email protected]) and [Dag](mailto:[email protected])) will be available for questions!
### Installing on Windows
If you are a Windows user, go to the [Git for Windows](https://gitforwindows.org/) web site and click the Download button. Make sure you notice *where* on the computer you download it to (for instance the 'Downloads' folder). When downloading has finished, go to the file (`Git-2.33.0.2-64-bit.exe`), *right-click* and select "Run as Administrator".
<img src = "images/git_installation_file.JPG" width="60%">
* Continue setup using the guidance in part *6.2 option 1* of [Chapter 6](https://happygitwithr.com/install-git.html) of Jenny Bryan’s [Happy Git and GitHub for the useR (happygitwithr.com)](happygitwithr.com). Especially note the options for *Adjusting your PATH environment*.
* **Mac and Linux users:** see [happygitwithr.com](https://happygitwithr.com/install-git.html).
### Set up Git
Open the Git Bash "shell" - see below - and use it to [introduce yourself to Git](https://happygitwithr.com/hello-git.html) - just 3 short commands.
<img src = "images/git_bash.JPG" width="60%">
### The rest
You can skip chapter 8 in [happygitwithr.com](happygitwithr.com) for now. The same for Chapter 9, which shows you how to work with the command-line interface of Git.
[Chapter 10](https://happygitwithr.com/credential-caching.html#activating-a-git-credential-helper) explains how to get a personal access token (PAT) from Github. Store the token (a bunch of random letters and numbers) by copy-pasting it to (for instance) a text file or a Google Document. Then, in R, run the following:
```
install.packages("gitcreds") # if you haven't already installed it, of course
library(gitcreds)
gitcreds_set()
```
Choose option 'Replace these credentials' and copy-paste your token.
### Test that your setup works
Try the work flow in [chapter 12](https://happygitwithr.com/rstudio-git-github.html) to see if RStudio detects the Git program. If it doesn't, please refer to [chapter 13](https://happygitwithr.com/rstudio-see-git.html).
* Again, we ([Viviane](mailto:[email protected]) and [Dag](mailto:[email protected])) will be available for questions!