Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent.md #31191

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

charleskimbac
Copy link
Contributor

@charleskimbac charleskimbac commented Jan 21, 2024

Why:

Fix some typos regarding what is actually shown in the terminal, and also fix a command which previously didn't work.
"ssh-add c:\Users\YOU.ssh\id_ed25519" (with backslashes) leads to error "c:UsersYOU.sshid_ed25519: No such file or directory".

Notes:

I had to run "eval `ssh-agent -s`" in bash before being able to run ssh-add (link), should maybe add this to the docs.

Check off the following:

  • I have reviewed my changes in staging, available via the View deployment link in this PR's timeline (this link will be available after opening the PR).

    • For content changes, you will also see an automatically generated comment with links directly to pages you've modified. The comment won't appear if your PR only edits files in the data directory.
  • For content changes, I have completed the self-review checklist.

Copy link

welcome bot commented Jan 21, 2024

Thanks for opening this pull request! A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Jan 21, 2024
Copy link
Contributor

Automatically generated comment ℹ️

This comment is automatically generated and will be overwritten every time changes are committed to this branch.

The table contains an overview of files in the content directory that have been changed in this pull request. It's provided to make it easy to review your changes on the staging site. Please note that changes to the data directory will not show up in this table.


Content directory changes

You may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request.

Source Preview Production What Changed
authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent.md fpt
ghec
ghes@ 3.11 3.10 3.9 3.8
fpt
ghec
ghes@ 3.11 3.10 3.9 3.8

fpt: Free, Pro, Team
ghec: GitHub Enterprise Cloud
ghes: GitHub Enterprise Server

@nguyenalex836 nguyenalex836 added content This issue or pull request belongs to the Docs Content team waiting for review Issue/PR is waiting for a writer's review ssh Content related to SSH and removed triage Do not begin working on this issue until triaged by the team labels Jan 22, 2024
@nguyenalex836
Copy link
Contributor

@charleskimbac Thanks so much for opening a PR! I'll get this triaged for review ✨

@guntrip
Copy link
Contributor

guntrip commented Jan 24, 2024

Hi @charleskimbac, thanks so much for opening this. This is interesting because we've only just changed the direction of the slashes based on previous feedback.

It was my understanding that the direction of the slashes wouldn't actually matter to Powershell, which can cope with both. To confirm this, I created a fresh Windows 11 VM to test. It looks like ssh-add really doesn't care how you provide the slashes:

PS C:\Users\adminadmin> ssh-add c:/Users/adminadmin/.ssh/id_ed25519
Identity added: c:/Users/adminadmin/.ssh/id_ed25519 (stevecat@github.com)

PS C:\Users\adminadmin> ssh-add c:/Users/adminadmin\.ssh\id_ed25519
Identity added: c:/Users/adminadmin\.ssh\id_ed25519 (stevecat@github.com)

PS C:\Users\adminadmin> ssh-add c:\Users\adminadmin\.ssh\id_ed25519
Identity added: c:\Users\adminadmin\.ssh\id_ed25519 (stevecat@github.com)

The same is true with ssh-keygen.

I'm curious if the errors you're seeing are due to a different version of ssh-add (for example, MinGW).

We can only really support a default installation but, as both slash-directions work on a default install, and it looks like switching back to forward slashes will help some folks such as yourself, let's do that!

I'll approve this and get your changes merged in. Thank you! ✨✨✨✨

I had to run "eval ssh-agent -s" in bash before being able to run ssh-add (link), should maybe add this to the docs.

Did you run Get-Service -Name ssh-agent | Set-Service -StartupType Manual and Start-Service ssh-agent first? As I had the fresh VM, I tested this too, and was only able to use ssh-add once I'd ran those two commands from our docs. As I've confirmed this is working as expected with a default installation, I think we should stick to our current procedure.

@guntrip guntrip added this pull request to the merge queue Jan 24, 2024
Merged via the queue into github:main with commit ce97819 Jan 24, 2024
74 checks passed
Copy link
Contributor

Thanks very much for contributing! Your pull request has been merged 🎉 You should see your changes appear on the site in approximately 24 hours. If you're looking for your next contribution, check out our help wanted issues

@charleskimbac
Copy link
Contributor Author

charleskimbac commented Jan 24, 2024

Hey @stevecat so I want to start by saying that I only have a bare knowledge of all of this, so apologies if I say/do something incorrectly.
In-line with step 2 of "Adding your SSH key to the ssh-agent", it starts by saying "In a terminal window without elevated permissions..." so I went back (from powershell) to my bash terminal (mingw) in VSCode, and attempted ssh-add. I guess you don't need the "eval `ssh-agent -s`" if you do it in Powershell vs bash, and it also explains the forward/back-slash discrepancy.

@guntrip
Copy link
Contributor

guntrip commented Jan 25, 2024

Ooh, thanks @charleskimbac! I'm experimenting with this and it appears that running the ssh-add command in Powershell might set things up so the key works in Powershell and Git Bash. This surprised me tbh!

Launching ssh-agent in Git Bash (using the eval command) does then allow you to run ssh-add as you mentioned.

I'm currently working on a project to revamp our SSH docs, and am paying extra attention to the Windows procedures. I'll work with our team to decide on the best option for that second step; either sticking with Powershell or adding the eval command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content This issue or pull request belongs to the Docs Content team ssh Content related to SSH waiting for review Issue/PR is waiting for a writer's review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants