Use gh cli to add SSH key to GitHub#320
Merged
Merged
Conversation
dmilon
suggested changes
Aug 30, 2021
Contributor
dmilon
left a comment
There was a problem hiding this comment.
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 🙏
Contributor
Author
|
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! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 addcli 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.comFrom my tests, once the SSH key has been added to GitHub, running a
git pullor any equivalent command from a repository connected to the right GH account runs the equivalent ofssh-add ~/.ssh/id_ed25519, i.e. even if the identity is not present in the SSH agent (runningssh-add -Ddeletes all of them for example if you would like to test), the~/.ssh/id_ed25519identity is added back to the SSH agent after runninggit 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 runninggh ssh-key addis 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.