Prerequisite
Install git
.
Have a Github account.
Set Name and Email
Give Git your name and email.
git config --global user.name "Your Name"
git config --global user.email "Your Email"
This email will be public on your git commits, so you may want to use your Github noreply email, found in the settings.
Master -> Main
Recently, Github changed the default branch name to main, but git
’s default is still master. Use this command to switch it:
git config --global init.defaultBranch main
This will print you the username and email that you typed:
git config --get user.name
git config --get user.email
Generate SSH Key
Create an ssh
key if it doesn’t exist.
[[ -f ~/.ssh/id_rsa.pub ]] || ssh-keygen -C $(git config --get user.email)
Copy your public key to the Linux Clipboard.
cat ~/.ssh/id_rsa.pub | xclip -sel c
Paste this code in Github Settings > import SSH & GPG keys.
Verify your SSH key.
ssh -T git@github.com