Install Git
$ brew install git
Set up global configs
You have to do this only once.
$ git config --global user.name "Steve Smith" # Name
$ git config --global user.email stevesmith@example.com # Email
$ git config --global core.editor nvim # Default editor (Neovim here)
$ git config --global core.autocrlf input # Line ending
Create SSH keys on your machine
Open the terminal and paste the following text
$ ssh-keygen -t ed25519 -C "stevesmith@example.com"
Accept the defaults. Ignore the passphrase.
Start the ssh-agent
$ eval "$(ssh-agent -s)"
Open SSH config file
$ nvim ~/.ssh/config
Past the text below in your config file
Host *.github.com
AddKeysToAgent yes
IdentityFile ~/.ssh/id_ed25519
Save and exit.
Add your SSH private key to the ssh-agent.
$ ssh-add ~/.ssh/id_ed25519
Copy the SSH public key to your clipboard.
$ pbcopy < ~/.ssh/id_ed25519.pub
Add SSH keys to GitHub
Visit GitHub keys and click on New SSH key
button.
Enter a meaningful title
Select
Authentication key
as 'Key type'Under the
Key
segment, paste from your clipboard.Click on
Add SSH key
button.
Check your SSH connection to GitHub
$ ssh -T git@github.com
On a successful connection, you will get a message like this.
$ Hi Steve Smith! You've successfully authenticated, but GitHub does not provide shell access.