πŸ’»Step 1: Github

Sign up for a free GitHub.com account at https://github.com/join if you don’t already have one.

Complete these installation instructions depending on your operating system:

1. Install Git on your laptop

If git already installed, you can the path to your git and version

$ which git
## /usr/bin/git

$ git --version
## git version 2.39.0

Download for macOS

First install homebrew if you don't already have it, then run the following command:

$ brew install git

Download for Windows

Follow this link for windows installation

2. Git configuration

Once git is installed, you can configure git by using your GitHub username and email address

$ git config --global user.name "John Doe"
$ git config --global user.email "johndoe@example.com"
$ git config --global --list

3. Set up credentials

To connect to GitHub via SSH, you will need to:

  1. Create new SSH key

  2. Add SSH key to GitHub account

Check for existing SSH key

Before generating new SSH key, verify if you already have one.

Open Git Bash, then:

$ ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist

Check if you have the following files by default

  • id_rsa.pub

  • id_ecdsa.pub

  • id_ed25519.pub

Create a new SSH key

Run the following commands in your bash

$ ssh-keygen -t ed25519 -C "your_email@example.com"
> Generating public/private ALGORITHM key pair.

# either set passphrase or leave it blank
> press enter
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]

Add SSH key to ssh-agent

Run the following commands in your bash

$ eval "$(ssh-agent -s)"
> Agent pid 59566

$ open ~/.ssh/config
> The file /Users/YOU/.ssh/config does not exist.

$ touch ~/.ssh/config

$ nano ~/.ssh/config
## paste the following in the config file
Host github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

$ ssh-add --apple-use-keychain ~/.ssh/id_ed25519

Add new SSH key to your GitHub account

Run the following commands in your bash

$ pbcopy < ~/.ssh/id_ed25519.pub
  # Copies the contents of the id_ed25519.pub file to your clipboard

this will copy your SSH Key to keypad, go to settings of your GitHub profile -> in the "Access" section on the sidebar, go to SSH and GPG keys -> New SSH Key or Add SSH key -> give a title & paste your previously copied key into the "Key" field.

4. Personal access token

  1. In the upper-right corner of any page, click your profile photo, then click Settings.

  2. In the left sidebar, click Developer settings.

  3. In the left sidebar, under Personal access tokens, click Tokens (classic)

  4. Click Generate new token.

  5. Under Token name, enter a name for the token.

  6. Under Expiration, select an expiration for the token.

  7. Give your token a descriptive name.

  8. Select the scopes you'd like to grant this token. You can select: repo & everything under repo admin:repo_hook & everything under repo delete_repo

  9. Click Generate token.

Make sure to copy & store this token safely. When you first configure your project, you will be asked for Username & Password as shown below. This is where you will use your token

$ git push -u origin main
Username: Your_Github_username
Password: Your_token

Last updated