Installing Git

Generating SSH key

  • Open Terminal, type these and just hit Enter
ssh-keygen -t ed25519

It will generate a public key ( and a private key (id_ed25519) in your home directory %userprofile%\.ssh. I’m gonna call it <private_file> and <public_file>.pub from now on.

Create config file

  • Navigate to %userprofile%\.ssh
  • Create new text file and name it config.txt
  • Add these lines
Host <your_git_service>.com
  HostName <your_git_service>.com
  IdentityFile ~/.ssh/<private_file>
  IdentitiesOnly yes
  • Save it and REMOVE THE .txt EXTENSION Explanation:
  • Line 1: matches the host <whatever>.com in git clone [email protected]<whatever>.com:...
  • Line 2: where to connect to, if you set it to, git clone [email protected]<whatever>.com:... will be “redirected” to git clone [email protected]:....
    Tip: set the Host and HostName to the same value for convenience.
  • Line 3: the private SSH key file path.
  • Line 4: the SSH connection should only use the specified IdentityFile; not any other identities which it might have access to (

Let’s say you have multiple GitHub accounts and multiple SSH keys. You can create multiple config files for each account and use the IdentityFile line to specify which SSH key to use for each account.

Host github.main
  IdentityFile ~/.ssh/id_github_main
  IdentitiesOnly yes
  IdentityFile ~/.ssh/id_github_work
  IdentitiesOnly yes

Add SSH key to Git service

Use the public key ( to add to your Git service:

After that you can delete the <public_file>.pub file if you want.

Test SSH connection

  • By cloning one of your repositories using the SSH URL. It will ask you to confirm the authenticity of the host, type yes and hit Enter, you only need to do this once.