Skip to content

Commit 1d0a4f3

Browse files
committedFeb 26, 2025
updated readme
1 parent d5c783b commit 1d0a4f3

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed
 

‎README.md

+23-5
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,20 @@ This creates a new SSH key, using the provided email as a label.
497497

498498
- When you're prompted to "Enter a file in which to save the key", you can press **Enter** to accept the default file location. Please note that if you created SSH keys previously, ssh-keygen may ask you to rewrite another key, in which case we recommend creating a custom-named SSH key
499499

500+
You can use this kay in serveral way, for istance to allow a pc thge connection to another pc:
501+
502+
```bash
503+
ssh-copy-id -i ~/.ssh/key-name.pub -p port-number username@real-server-address
504+
```
505+
506+
When you run this command:
507+
508+
- You will be prompted for the user's password on the remote server.
509+
- The command will add your public key to the file ~/.ssh/authorized_keys on the remote server.
510+
- From that moment on, you will be able to access the server using your corresponding private key without having to enter a password.
511+
512+
This is a fundamental step in setting up SSH access with key authentication, which is more secure and convenient than using passwords.
513+
500514
### Add the ssh key to your github account
501515

502516
- Copy the SSH public key to your clipboard:
@@ -529,25 +543,29 @@ git remote add origin <the link of your remote repo>
529543
Managing multiple account on different repos or in the same repo require an additional file in .ssh/config:
530544

531545
```text
546+
Host alias-name-to-use-ssh-command
547+
HostName real-server-address
548+
User username
549+
IdentityFile ~/.ssh/id_ed25519.pub
550+
Port 2222
551+
532552
Host gitlab.com
533553
HostName gitlab.com
534554
User git
535555
PreferredAuthentications publickey
536-
IdentityFile ~/.ssh/gitlab_personal
556+
IdentityFile ~/.ssh/id_ed25519.pub
537557
538-
# github-work
539558
Host github.com
540559
HostName github.com
541560
User git
542561
PreferredAuthentications publickey
543-
IdentityFile ~/.ssh/github_work
562+
IdentityFile ~/.ssh/id_ed25519.pub
544563
545-
# github-personal
546564
Host github-personal
547565
HostName github.com
548566
User git
549567
PreferredAuthentications publickey
550-
IdentityFile ~/.ssh/github_personal
568+
IdentityFile ~/.ssh/id_ed25519.pub
551569
```
552570

553571
With this config file you con manage multiple accounts. You just need to match the ssh key with the one in the config file and the remote link has to match the one specified on the config file. Fors istance to clone a repo:

0 commit comments

Comments
 (0)
Please sign in to comment.