Pin Loon's Wiki
  • Welcome to my technical notes
  • About Me
  • Linux
    • Basic commands
    • Controller Area Network (CAN)
    • Disk
    • Ethernet
    • Systemd Service
    • SSH
  • Microcontroller / Single Board Computer
    • Debugger / Compiler
    • Raspberry Pi 4
  • Application Platform
    • Docker
    • Docker Compose
  • Application Notes
    • Dataype Overflow
    • Macros
    • Wrong Casting
    • Variadic Function
  • Git
    • Create SSH Keys
    • Git submodule
  • VPN
    • Wireguard Setup on Azure
Powered by GitBook
On this page
  • Generate key pairs
  • To validate key pairs
  • Note
  • Adding multiple account
  • References
  1. Git

Create SSH Keys

Generate key pairs

$ ssh-keygen -t ed25519 -C "your_email@example.com"

You can choose another algorithms such as

$ ssh-keygen -t rsa -b 4096
$ ssh-keygen -t ecdsa -b 521

To validate key pairs

After adding your public keys, you validate it for example github

$ ssh -T git@github.com

Note

  • For Windows user, make sure your ssh-agent is running.

  • You can open Windows PowerShell and check it by command below.

Get-Service ssh-agent
  • If it is not running you can set it at Services App

Adding multiple account

$ nano ~/.ssh/config
  • added information of your account

Host github.com
	HostName github.com
	User git
	IdentityFile ~/.ssh/id_rsa_account1

Host github.com-account2
	HostName github.com
	User git
	IdentityFile ~/.ssh/id_rsa_account2
  • You can test and establish the connection through

$ ssh -T git@github.com-account2
  • For account1, you can use as normal or as your main account

  • For account2, remember to replace "github.com" with "github.com-account2", for example

$ git clone git@github.com-account2:<your_username>/<your_repo>.git

References

  1. https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account

  2. https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement

PreviousVariadic FunctionNextGit submodule

Last updated 3 years ago