-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
content/remotes: Example of what a SSH or HTTPS selector could look l…
…ike. - As discussed in an idea - Installation instructions would still need to be updated - Review: is correct? Is simpler? Is useful?
- Loading branch information
Showing
1 changed file
with
83 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 GitHub Actions / Build and gh-pages
|
||
[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 | ||
|
@@ -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 | ||
``` | ||
|
@@ -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 | ||
|