install and set up git
$ sudo apt-get update
$ sudo apt install git
# to check if it is correctly installed
$ git --version
# to set the account's default identity
$ git config --global user.email "you@example.com"
$ git config --global user.name "Your Name"
Generate ssh key following here. Adding locally hosted code to GitHub following here.
To summarize, basically do the following
$ ssh-keygen -t ed25519 -C "your_email@example.com"
# start the ssh-agent in the background
$ eval "$(ssh-agent -s)"
# <key_path> is something like ~/.ssh/id_ed25519
$ ssh-add <key_path>
# show the public key
$ cat ~/.ssh/id_ed25519.pub
Copy the shown public key and add it to SSH keys in your github account.
Git cheat sheet: here.