May 3, 2024

git

Set up your pub key

On a new computer where you want to set up your github account, first check if your public key exists already or not

$ ls -lart ~/.ssh

to see if existing SSH keys are present. If none is,

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

Press enter when prompted for a passphrase if you want it to be blank.

If you are using a legacy system that doesn’t support the Ed25519 algorithm, use:

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
$ cat ~/.ssh/id_ed25519.pub

Upload it to github

  1. Then select and copy the contents of the id_ed25519.pub file displayed in the terminal to your clipboard.
  2. Then login on github.com and in the upper-right corner of any page, click your profile photo, then click “Settings”.
  3. In the “Access” section of the sidebar, click SSH and GPG keys
  4. Click New SSH key or Add SSH key.
  5. In the “Title” field, add a descriptive label for the new key. For example, if you’re using a personal laptop, you might call this key “Personal laptop”.

Set up things globally

On the laptop your username and email, run

$ git config --global user.name myusername
$ git config --global user.email myemail