To push commits to the Worg repository at https://git.sr.ht/~bzg/worg you need to have a SSH key. What's that and how can you create one?
Public and private keys
A public key is like a door lock, and a private key is like the key.
sr.ht is asking you for the public key, that means, they ask you to
provide a lock, and they will install your lock in their server.
Then, with your private key you will be able to open a connection to
Your private key may be easy to use: just have it, and you can use it to open the lock.
But suppose you lose it; then it's not secure anymore; any person which has the key (which is a file) can connect to the server supplanting your identity.
Therefore, at the computer we do that the private key has a password (also called "passphrase"). Then, you do not only need to possess the key to open the lock; you also need to know how to use it (that means, you must have the public key and know the password).
So: use a passphrase for more security.
Steps to create your private and public keys
ssh-keygenwith no parameters. If you want to change the encryption algorithm used, see the section below.
- Location of the key: just press enter
- Passphrase of the key: enter your new password; the one you will type each time to be able to connect. You can have no password at all, but it's not recommended; read the description at the introduction to know why.
- Now you have 2 new files:
id_rsa: that's your new private key. Don't share it!
id_rsa.pub: that's your new public key. You can distribute it.
- You will also see a fingerprint (like
- Look at the public key. If you don't like the user name which appears
at the end, re-run
ssh-keygen -C "comment that you want"
RSA or DSA?
You can decide if at the key creation you want to use the algorithm RSA or the algorithm DSA.
If you know which one you like, you're lucky; use it!
If not, decide one; both will work.
ssh-keygen uses RSA, but you can use
ssh-keygen -t dsa to