-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathinstall-git-github.Rmd
More file actions
166 lines (114 loc) · 5.57 KB
/
install-git-github.Rmd
File metadata and controls
166 lines (114 loc) · 5.57 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
---
title: "Git and GitHub CLI Installation Guide"
subtitle: "A Step-by-step guide for Git and GitHub installation and configuration."
fontsize: 12pt
output:
html_document:
df_print: paged
toc: yes
toc_depth: 2
highlight: pygments
includes:
in_header: copy-code.html
after_body: comment.html
# pdf_document:
# toc: yes
# toc_depth: 3
# word_document:
# toc: yes
# toc_depth: '3'
header-includes:
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \renewcommand{\footrulewidth}{0.4pt}
- \fancyhead[LE,RO]{\thepage}
- \geometry{left=1in,top=0.75in,bottom=0.75in}
- \fancyfoot[CE,CO]{{\includegraphics[height=0.5cm]{images/cc-by-nc.png}} Ujaval Gandhi http://www.spatialthoughts.com}
classoption: a4paper
---
## Install Git
### Windows
1. Go to [git-scm.com](https://git-scm.com/install/windows) and download the latest version of *Git for Windows*. During install, accept all defaults.
```{r echo=FALSE, fig.align='center', out.width='75%'}
knitr::include_graphics('images/common/gitwindows.png')
```
### Mac
Most versions of MacOS will already have Git installed, and you can activate it through the terminal. Open *Terminal* and run the following command. If Git is installed, it will print the version. If it is not installed, macOS will prompt you to install it.
```
git --version
```
```{r echo=FALSE, fig.align='center', out.width='60%'}
knitr::include_graphics('images/common/gitmac.png')
```
### Linux
You can install Git via the package management tool for your Linux distribution. GitHub has a detailed [Install Git for Linux](https://github.com/git-guides/install-git#install-git-on-linux) guide with instructions for different operating systems.
## Configure Git
Once installed, *(Windows users)*, search for Windows Powershell and launch it. *(Mac/Linux users)*: Launch a Terminal window.
Run the following commands to set your name and email. Make sure to change `<Your Name>` and `<your-email@example.com>` with your own details.
```bash
git config --global user.name "<Your Name>"
```
```bash
git config --global user.email "<your-email@example.com>"
```
```{r echo=FALSE, fig.align='center', out.width='75%'}
knitr::include_graphics('images/common/gitconfig.png')
```
## Install GitHub CLI
GitHub offers a Command-Line Interface (CLI) to manage your GitHub account. We will install and configure it so you can push updates to your GitHub repositories.
### Windows
Search for *Windows Powershell* and launch it. Enter the following command and follow the installation prompts.
```
winget install --id GitHub.cli
```
```{r echo=FALSE, fig.align='center', out.width='75%'}
knitr::include_graphics('images/common/ghwindows.png')
```
In case you have trouble with this method, Github also offers [pre-compiled binaries](https://github.com/cli/cli/blob/trunk/docs/install_windows.md#precompiled-binaries) that can be downloaded and installed directly.
### Mac
You can install the GitHub CLI via Homebrew. In case you do not have Homebrew install, head over to [Homebrew](https://brew.sh/) and install it first.
Open a Terminal and enter the following command
```
brew install gh
```
```{r echo=FALSE, fig.align='center', out.width='75%'}
knitr::include_graphics('images/common/ghmac.png')
```
In case you have trouble with this method, Github also offers [pre-compiled binaries](https://github.com/cli/cli/blob/trunk/docs/install_macos.md#precompiled-binaries) that can be downloaded and installed directly.
### Linux
Visit [GitHub CLI Linux & Unix Installation](https://github.com/cli/cli#linux--unix) guide for instructions for your distribution.
## Configure GitHub CLI
You will need a GitHub account for this section. If you do not have one, visit [GitHub.com](https://github.com/) and create a free account.
1. *(Windows users)*, search for Windows Powershell and launch it. *(Mac/Linux users)*: Launch a Terminal window. Enter the following command to sign-in to your GitHub account.
```{r echo=FALSE, fig.align='center', out.width='75%'}
knitr::include_graphics('images/common/gh1.png')
```
2. Select `GitHub.com` as the response for *Where do you use GitHub?* and press *Enter*. Next, select `HTTPS` as the response for *What is your preferred protocol for Git operations on this host?* and press *Enter*.
```{r echo=FALSE, fig.align='center', out.width='75%'}
knitr::include_graphics('images/common/gh2.png')
```
3. Choose `Login with a web browser` as the option for *How would you like to authenticate GitHub CLI?* and press *Enter*.
```{r echo=FALSE, fig.align='center', out.width='75%'}
knitr::include_graphics('images/common/gh3.png')
```
4. You will be prompted to copy a code. Select the code and copy it. You will need it in the next step. Press *Enter*.
```{r echo=FALSE, fig.align='center', out.width='75%'}
knitr::include_graphics('images/common/gh4.png')
```
5. A new browser tab will open and you will be prompted to sign-in to GitHub for *Device Activation*. Click *Continue*.
```{r echo=FALSE, fig.align='center', out.width='60%'}
knitr::include_graphics('images/common/gh5.png')
```
6. In the next step, you will have will be prompted to *Authorize your device*. Paste the code and click *Continue*.
```{r echo=FALSE, fig.align='center', out.width='60%'}
knitr::include_graphics('images/common/gh6.png')
```
7. Once completed, you can close the browser tab.
```{r echo=FALSE, fig.align='center', out.width='60%'}
knitr::include_graphics('images/common/gh7.png')
```
8. Back in the Terminal, you should see a confirmation message.
```{r echo=FALSE, fig.align='center', out.width='75%'}
knitr::include_graphics('images/common/gh8.png')
```
Your setup is now complete.