You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+23-5
Original file line number
Diff line number
Diff line change
@@ -497,6 +497,20 @@ This creates a new SSH key, using the provided email as a label.
497
497
498
498
- 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
499
499
500
+
You can use this kay in serveral way, for istance to allow a pc thge connection to another pc:
- 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
+
500
514
### Add the ssh key to your github account
501
515
502
516
- Copy the SSH public key to your clipboard:
@@ -529,25 +543,29 @@ git remote add origin <the link of your remote repo>
529
543
Managing multiple account on different repos or in the same repo require an additional file in .ssh/config:
530
544
531
545
```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
+
532
552
Host gitlab.com
533
553
HostName gitlab.com
534
554
User git
535
555
PreferredAuthentications publickey
536
-
IdentityFile ~/.ssh/gitlab_personal
556
+
IdentityFile ~/.ssh/id_ed25519.pub
537
557
538
-
# github-work
539
558
Host github.com
540
559
HostName github.com
541
560
User git
542
561
PreferredAuthentications publickey
543
-
IdentityFile ~/.ssh/github_work
562
+
IdentityFile ~/.ssh/id_ed25519.pub
544
563
545
-
# github-personal
546
564
Host github-personal
547
565
HostName github.com
548
566
User git
549
567
PreferredAuthentications publickey
550
-
IdentityFile ~/.ssh/github_personal
568
+
IdentityFile ~/.ssh/id_ed25519.pub
551
569
```
552
570
553
571
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