Skip to content

Commit

Permalink
content/remotes: Example of what a SSH or HTTPS selector could look l…
Browse files Browse the repository at this point in the history
…ike.

- As discussed in an idea
- Installation instructions would still need to be updated
- Review: is correct?  Is simpler?  Is useful?
  • Loading branch information
rkdarst committed Sep 12, 2023
1 parent a8ab90e commit 6229592
Showing 1 changed file with 83 additions and 8 deletions.
91 changes: 83 additions & 8 deletions content/remotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,10 @@ There are different types of remotes:

## Type-along: Create a new repository on GitHub

```{admonition} We need SSH keys configured for this part to work
To try this part during exercise or type-along, you need SSH keys configured
and the public key deposited on GitHub (see our [installation
instructions](https://coderefinery.github.io/installation/ssh/)).
```{important}
If you do not have these configured, please watch as we do this episode and you
can prepare before the [collaborative Git
lesson](https://coderefinery.github.io/git-collaborative/), where we will need
this set up.
Don't do anything yet. We make a choice in the next section, and then
do these steps in the following one.
```

For the rest of this page, we will make a new repository for our
Expand Down Expand Up @@ -133,6 +128,52 @@ Once you click the green "Create repository", you will see a page similar to:
What this means is that we have now an empty project with either an HTTPS or an
SSH address: click on the HTTPS and SSH buttons to see what happens.

---

## Authenticating to Github: SSH or HTTPS?

**How does Github know who you are?** This is hard and there are two
options.

* **SSH** is the classic method, which could have been set up in the

Check warning on line 138 in content/remotes.md

View workflow job for this annotation

GitHub Actions / Build and gh-pages

'myst' reference target not found: LINK

Check warning on line 138 in content/remotes.md

View workflow job for this annotation

GitHub Actions / Build and gh-pages

'myst' reference target not found: LINK
[installation instructions](LINK)
* **HTTPS** works with the **Git Credential Manager**, which is an
extra add-on that works easily in Windows and Mac.

Test which one you should use:

`````{tabs}
````{group-tab} SSH
Try this command:
```console
$ ssh -T [email protected]
```
If it returns `Hi USERNAME! You've successfully authenticated, ...`,
then SSH is configured and the following steps will work with the SSH
cloning.
See our [installation
instructions](https://coderefinery.github.io/installation/ssh/) to
set up SSH access.
````
````{group-tab} HTTPS
```console
$ git config --get credential.manager
```
If it return anything, then the credential manager is probably
configured and HTTPS cloning will work (but you can't verify it until
you try using it).
````
`````

If you do not have these configured, please watch as we do this episode and you
can prepare before the [collaborative Git
lesson](https://coderefinery.github.io/git-collaborative/), where we will need
one of these set up.


---

## Pushing our guacamole recipe repository to GitHub
Expand All @@ -149,8 +190,23 @@ We now want to try the second option that GitHub suggests:
3. Copy paste the three lines to the terminal and execute those, in my case (**you
need to replace the "user" part and possibly also the repository name**):


`````{tabs}
````{group-tab} SSH
See above for if SSH is the right option for you.
```console
$ git remote add origin [email protected]:user/recipe.git
```
````
````{group-tab} HTTPS
See above for if HTTPS is the right option for you.
```console
$ git remote add origin https://github.com/user/recipe.git
```
````
`````

```console
$ git branch -M main
$ git push -u origin main
```
Expand Down Expand Up @@ -198,16 +254,35 @@ we will learn how this works.
At this point only a brief demo - if you copy the SSH or HTTPS address, you can clone repositories like this
(again adapt the "namespace/repository.git" part):


`````{tabs}
````{group-tab} SSH
```console
$ git clone [email protected]:user/recipe.git
```
````
````{group-tab} HTTPS
```console
$ git clone https://github.com/user/recipe.git
```
````
`````

This creates a directory called "recipe" unless it already exists. You can also specify the target directory
on your computer:

`````{tabs}
````{group-tab} SSH
```console
$ git clone [email protected]:user/recipe.git myrecipe
```
````
````{group-tab} HTTPS
```console
$ git clone https://github.com/user/recipe.git myrecipe
```
````
`````

What just happened? **Think of cloning as downloading the `.git` part to your
computer**. After downloading the `.git` part the branch pointed to by HEAD is
Expand Down

0 comments on commit 6229592

Please sign in to comment.