-
Notifications
You must be signed in to change notification settings - Fork 2
/
3.1-what_is_github.qmd
111 lines (77 loc) · 3 KB
/
3.1-what_is_github.qmd
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
---
title: "Intro to `git`"
subtitle: "Block 3.1: Going Online - Github"
---
## What is GitHub?
- GitHub is a website to host git repositories
- By having your git repository online, you can easily collaborate with others
- There are many other similar, alternative websites
- Codeberg 🇩🇪
- GitLab
- Bitbucket
- ... (and many more)
- Together they contain the majority of the world's software
## Why use a Website?
- Backup of your project
- Collaboration
- Not just with people you know
- Free and Open-Source Software (FOSS)
- Visibility
# Demo: A Tour of github.com
# Connecting git and github
## Authenticating with GitHub 🗝️ {background-color="black"}
- We will use a great external guide to set up the authentication with GitHub
- Please go to the [website](https://lmu-osc.github.io/Introduction-RStudio-Git-GitHub/SSH.html) and follow the steps to authenticate with GitHub
- A PDF version of the guide can be found [here](./resources/ssh/how-to-setup-github-ssh.pdf)
![https://lmu-osc.github.io/Introduction-RStudio-Git-GitHub/SSH.html](images/qr_code-lmu-osc-ssh.svg)
::: attribution
External Guide by Mike Croucher & Malika Ihle
:::
## Cloning a Repository
- You can download repositories from GitHub (and anywhere else), by *cloning* them
- For public repositories, `git clone` just works, for private ones you will need to be authenticated
- `git clone <remote URL>`
## Cloning a Repository
![You can find the remote URL by going to a repository on GitHub and clicking the Code button](images/screenshots/github-get-remote-url.png)
```bash
git clone git@github.com:jansim/intro-to-git.git
```
## Practical: Cloning a private repository {background-color="black"}
1. Go to the website of the repository I added you all to: `https://github.com/open-teaching/git-course-summary-<current-term>`
2. Copy the SSH clone URL from the repositories website
3. Clone the repository to check whether you can authenticate with github
# Remotes {background-color="black" background-opacity="0.3" background-image="images/backgrounds/glenn-carstens-peters-EOQhsfFBhRk-unsplash.jpg"}
::: attribution
Background: https://unsplash.com/photos/EOQhsfFBhRk
:::
## Remotes
- Link to a remote repository on a hosting website
- There can be more than one remote, but it is uncommon
- Just like your repository, the remote repository also has branches
- The default name for a remote is `origin`
- When you `clone` a repository, this remote is already linked
## Adding a Remote
When you want to add an existing repository to github, you will have to add the remote yourself
```bash
git remote add <remote name> <remote URL>
```
<br>
::: {.fragment}
For example:
```bash
git remote add origin git@github.com:jansim/intro-to-git.git
```
:::
<br>
::: {.fragment}
To learn about all possible commands for remotes use `-h`
```bash
git remote -h
```
:::
## *End of Section* 🎉 {background-color="black"}
:::{.r-fit-text}
Any Questions?
:::
[[🏡 Back to Overview]](./index.html)
[[⏩️ Next Section]](./3.2-synching_changes.html)