Skip to content

Use gh cli to add SSH key to GitHub#320

Merged
dmilon merged 2 commits into
lewagon:masterfrom
trouni:use-gh-cli-for-ssh-setup
Sep 3, 2021
Merged

Use gh cli to add SSH key to GitHub#320
dmilon merged 2 commits into
lewagon:masterfrom
trouni:use-gh-cli-for-ssh-setup

Conversation

@trouni
Copy link
Copy Markdown
Contributor

@trouni trouni commented Aug 26, 2021

Content of this PR

This replaces the current manual flow of adding the SSH key to GitHub via the UI. Instead, it uses the gh ssh-key add cli command.

Notable changes

Order of sections

In addition to the updated instructions, the order has been modified so that the SSH Key section appears only after the GitHub CLI setup.

Removal of ssh -T git@github.com

From my tests, once the SSH key has been added to GitHub, running a git pull or any equivalent command from a repository connected to the right GH account runs the equivalent of ssh-add ~/.ssh/id_ed25519, i.e. even if the identity is not present in the SSH agent (running ssh-add -D deletes all of them for example if you would like to test), the ~/.ssh/id_ed25519 identity is added back to the SSH agent after running git pull.

It might however be worth testing this behavior, especially on Windows and Ubuntu.

An alternative way to test for the correct setup would be to run gh ssh-key list, but since the message after running gh ssh-key add is very explicit, I don't think that step is necessary anymore, unlike when the setup was done manually in the browser and needed some verification from the terminal.

Copy link
Copy Markdown
Contributor

@dmilon dmilon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @trouni 👋

Thank you for your PR 🙏

This new way of adding the SSH key to GitHub is way easier than the previous one 🙌

I've just tested it on my Linux machine after deleting my SSH key on GitHub and it recreated it like a charm 👍

I just have a small case change request and I'll merge it 🙏

Comment thread _partials/ssh_key.md Outdated
@dmilon dmilon merged commit 23c081f into lewagon:master Sep 3, 2021
@trouni
Copy link
Copy Markdown
Contributor Author

trouni commented Sep 17, 2021

Hey @dmilon!

Sorry for the late reaction, I don't get notifications when this gets merged somehow... Anyway, glad it worked well for you too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants