Use RSA encryption with 4096
bits
ssh-keygen -t rsa -b 4096 -C "[email protected]" -f ~/.ssh/myserver.key -P ""
The command above will generate two files, the private key ~/.ssh/myserver.key
and the public key ~/.ssh/myserver.key.pub
.
Now you can use th SSH key pair to access machines via SSH
To connect via SSH without a password using a simplified command you can use the following instrucctions:
Edit the file ~/.ssh/config
and add the following:
Host myserver.com
HostName myserver.com
User myuser
IdentityFile ~/.ssh/myserver.key
Now you can use any SSH connection command passwordless:
ssh myserver.com
You can also configre the remote Git server in your local repo using the SSH configuration, e.g.
[email protected]
- Upload the public key to the machine in the
~/.ssh/authorized_keys
file or upload to the Git service - Keep you private key secure in your local machine.
- Use you private key to connect to the server