The Codeberg Documentation website is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
It bundles third-party font software licensed under a different license. Please look at the LICENSE file for details.
Changes to the original versions of the article as well as its individual authors can be looked up in this article's commit history
Codeberg and the Codeberg Logo are trademarks of Codeberg e.V.
It is recommended to use one key per client. This means that if you access your Codeberg repository from your home PC, your laptop and your office PC you should generate separate keys for each machine.
Open Terminal on Linux/macOS, or Git Bash on Windows.
Paste the text below:
ssh-keygen -t ed25519 -a 100
This will generate a new SSH key.
You can also add a comment to help you identify the client with -C "comment here"
.
> Generating public/private ed25519 key pair.
When you're prompted to "Enter a file in which to save the key", press Enter. This accepts the default file location:
> Enter file in which to save the key (/home/knut/.ssh/id_ed25519): [Press enter]
You will be asked for a passphrase; enter one if you'd like, or leave the prompt empty.
Your private key can be protected by a passphrase. This adds a layer of authentication that increases security. Be aware that this will only be helpful for certain attack scenarios and does not offer 100% protection. It is recommended to keep your private key safe and - well - private.
Connect your security key and open a terminal
Paste the text below
ssh-keygen -t ed25519-sk
If you have set one on your key, you'll be prompted for your FIDO2 PIN. Enter it to continue
When you're prompted to "Enter a file in which to save the key", press Enter. This accepts the default file location.
You will be asked for a passphrase; enter one if you'd like, or leave the prompt empty.
Keep in mind that now, every time you wish to use Codeberg over SSH, you must have your security key plugged in and will be prompted to touch it to continue.
Copy the SSH key to your clipboard. You must only copy the public key not the private one. You can identify it by the .pub
suffix. By default, you can find the public key in $HOME/.ssh/id_ed25519.pub
.
On Linux you can use xclip
on the command line. You may need to install it from your package manager.
$ xclip -selection clipboard < ~/.ssh/id_ed25519.pub
On Windows you can use clip
.
$ clip < ~/.ssh/id_ed25519.pub
On macOS you can use pbcopy
.
$ pbcopy < ~/.ssh/id_ed25519.pub
These commands will copy the contents of id_ed25519.pub (your SSH public key) to your clipboard.
Alternatively you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.
Navigate to your user settings