Skip to content

Commit 21f801d

Browse files
authored
include code snippets for adding private ssh-key to agent
1 parent 4ac5ff3 commit 21f801d

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

book/chapters/git-and-github.qmd

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,23 @@ The key's randomart image is:
156156

157157
### Add the private key to the ssh-agent
158158

159-
We will now 'activate' your private key. To add your private key to the ssh-agent on your local computer, please follow the steps under [Adding your SSH key to the SSH agent](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent).
159+
We will now 'activate' your private key. To add your private key to the ssh-agent on your local computer, type the following in your Terminal:
160160

161-
At the top of the page, be sure to **select Linux as the operating system, even if you use Windows or MacOS** and type the commands provided in your terminal. We've had issues with the instructions for the other operating systems.
161+
First, activate the ssh-agent in the background:
162+
163+
```{r eval=FALSE}
164+
eval "$(ssh-agent -s)"
165+
```
166+
167+
Then, add your private key to the ssh-agent.
168+
169+
```{r eval=FALSE}
170+
ssh-add ~/.ssh/id_ed25519
171+
```
172+
173+
Note that if you created a key with a different name, you will have to replace _id_ed25519_ accordingly.
174+
175+
The above steps are from [Adding your SSH key to the SSH agent](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent). At the top of the guide, we have **selected Linux as the operating system, even if Windows or MacOS are used**. We've had issues with the instructions for the other operating systems, likely because we're using a BASH terminal for Git.
162176

163177
### Add public key to your GitHub/GitLab/BitBucket account
164178

0 commit comments

Comments
 (0)