Appendix
Git and Github

Git and Github

GitHub Logo

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed andefficiency.

👾

Tested on macOS Sonoma 14.0

⚠️

THIS PAGE IS CURRENTLY UNDER CONSTRUCTION

Installing Git and Adding SSH Key for GitHub (macOS)

Step 1: Install Git

  1. Open Terminal.

    For more information please see:

    How to open terminal in macOS
  2. Check if Git is already installed by running the following command:

    console
    $ git --versio
    > git version 2.33.1

    If you see the Git version information, skip to Step 2: Generate SSH key. Otherwise, continue to the next step.

  3. Install Homebrew

    How to Install Homebrew on macOS
    💡

    If you already have Homebrew installed on your macOS, you can skip this step.

  4. Once Homebrew is installed, run the following command to install Git:

    sh
    brew install git

Step 2: Generate SSH Key

  1. Run the following command to generate a new SSH key:

    sh
    ssh-keygen -t ed25519 -C sample@mail.com
    💡

    Replace sample@mail.com with your own email address associated with your GitHub account.

  2. You will be prompted to enter a file in which to save the key. Press Enter to accept the default location.

Step 3: Add SSH Key to GitHub

  1. Open a web browser and go to GitHub (opens in a new tab).

  2. Click on your profile picture in the top-right corner

    then select Settings from the dropdown menu.

  3. In the left sidebar, click on SSH and GPG keys Click on the New SSH key.

  4. Switch to the Terminal application and run the following command to copy your public SSH key to the clipboard:

    sh
    pbcopy < ~/.ssh/id_ed25519.pub

    OR you can run the following command to print the key to the Terminal and copy it manually:

    sh
    cat ~/.ssh/id_ed25519.pub

    You should see a message like:

    console
    $ cat ~/.ssh/id_ed25519.pub
    > ssh-ed25519 your_key...blablabla your.mail@example.com
  5. Return to the browser and paste the copied key into the Key field on the GitHub website.

  6. Click the Add SSH key button to save the key.

    add-ssh-key-button

    You have successfully added your SSH key to your GitHub account.

Additional: Test SSH Connection

  1. In the Terminal application, run the following command to test the SSH connection with GitHub:

    sh
    ssh -T git@github.com
  2. You may see a warning message about the authenticity of the host. Type "yes" to continue.

  3. If everything is set up correctly, you should see a message like:

    check-connect-ssh

    In this case AppleBoiy is my GitHub username. You should see your own username instead.

References

SourceDescription
How to Install Git on Mac (opens in a new tab)Atlassian tutorial on installing Git on macOS
Generating a new SSH key and adding it to the ssh-agent (opens in a new tab)GitHub documentation on generating a new SSH key and adding it to the ssh-agent
Adding a new SSH key to your GitHub account (opens in a new tab)GitHub documentation on adding a new SSH key to your GitHub account
Testing your SSH connection (opens in a new tab)GitHub documentation on testing your SSH connection