From 17853f6dc832efdb9fa474845f7815b603036d8b Mon Sep 17 00:00:00 2001 From: Trouni Tiet Date: Fri, 27 Aug 2021 01:17:02 +0900 Subject: [PATCH 1/2] use gh cli to add SSH key to GitHub --- _partials/ssh_key.md | 37 +++++-------------------------------- build.rb | 6 +++--- 2 files changed, 8 insertions(+), 35 deletions(-) diff --git a/_partials/ssh_key.md b/_partials/ssh_key.md index af9b25d2..04af409b 100644 --- a/_partials/ssh_key.md +++ b/_partials/ssh_key.md @@ -25,42 +25,15 @@ Now, you will give your **public** key to GitHub. In your terminal copy-paste the following command: ```bash -cat ~/.ssh/id_ed25519.pub +gh auth refresh -s write:public_key ``` -It will prompt on the screen the content of the `id_ed25519.pub` file. +It will prompt a one time code (####-####) on the screen. Copy it and press `ENTER`, then paste the code in your browser and follow the instructions to **Authorize github**. -- Copy that text from `ssh` to the end of your email address -- Go to [github.com/settings/ssh](https://github.com/settings/keys) -- Click on the green button `New SSH key` -- Fill in the Title with your computer name (`Macbook Pro` for instance) -- Paste the **key** -- Finish by clicking on the **Add SSH key** green button. - -To check that this step is completed, in the terminal run this. +Back in the terminal, press `ENTER` and run this: ```bash -ssh -T git@github.com -``` - -:warning: You will be prompted a warning, type `yes` then `ENTER`. - -This is the expected result: - +gh ssh-key add ~/.ssh/id_ed25519.pub ``` -# Hi --------! You've successfully authenticated, but GitHub does not provide shell access -``` - -:heavy_check_mark: If you got this message, the key was added to GitHub successfully :+1: - -:x: If you encountered an error, you will have to try again. Do not hesitate to **contact a teacher**. - -
- If ssh -T git@github.com does not work - - Try running this command before trying again: - ```bash - ssh-add ~/.ssh/id_ed25519 - ``` -
+This should return `✓ Public key added to your account`. If not, do not hesitate to **contact a teacher**. \ No newline at end of file diff --git a/build.rb b/build.rb index 860241a4..44ceb2eb 100755 --- a/build.rb +++ b/build.rb @@ -14,8 +14,8 @@ vscode_liveshare macos_terminal oh_my_zsh - ssh_key gh_cli + ssh_key dotfiles macos_rbenv ruby @@ -44,9 +44,9 @@ git zsh oh_my_zsh - ssh_key windows_browser gh_cli + ssh_key dotfiles windows_ssh rbenv @@ -71,8 +71,8 @@ git zsh oh_my_zsh - ssh_key gh_cli + ssh_key dotfiles rbenv ruby From 2d373ba8a9700e4dd8b68c8a3027adbae54c10c8 Mon Sep 17 00:00:00 2001 From: Damien Milon <37899667+dmilon@users.noreply.github.com> Date: Fri, 3 Sep 2021 10:51:03 +0200 Subject: [PATCH 2/2] Update _partials/ssh_key.md --- _partials/ssh_key.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_partials/ssh_key.md b/_partials/ssh_key.md index 04af409b..5df9e081 100644 --- a/_partials/ssh_key.md +++ b/_partials/ssh_key.md @@ -28,7 +28,7 @@ In your terminal copy-paste the following command: gh auth refresh -s write:public_key ``` -It will prompt a one time code (####-####) on the screen. Copy it and press `ENTER`, then paste the code in your browser and follow the instructions to **Authorize github**. +It will prompt a one time code (####-####) on the screen. Copy it and press `ENTER`, then paste the code in your browser and follow the instructions to **Authorize GitHub**. Back in the terminal, press `ENTER` and run this: