Travis lord Logo
Setting Up SSH & GitHub on Your MacBook 💻

Setting Up SSH & GitHub on Your MacBook 💻

3 min read

Published on: Tue Jun 04 2024

Connecting to GitHub with SSH

Follow these steps to get started with GitHub on your MacBook:

You can connect to GitHub using the Secure Shell Protocol (SSH), which provides a secure channel over an unsecured network.
GitHub Docs

1. Install Git

Git is the version control system that GitHub relies on. If it’s not already installed, follow these steps:

  1. Open the Terminal app (found in the Utilities folder within the Applications folder).

  2. Check if Git is installed:

     git --version
    
  3. If Git is not installed, you will be prompted to install the Xcode Command Line Tools. Follow the prompts to install it.

  4. Verify that Git is installed by running:

     git --version
    

2. Configure Git

Configure Git with your name and email address:

git config --global user.name "Your Name"
git config --global user.email youremail@example.com

SSH keys provide a secure way to authenticate with GitHub.

  1. Check for existing SSH keys:

     ls -al ~/.ssh
    
  2. Generate a new SSH key:

     ssh-keygen -t ed25519 -C "youremail@example.com"
    
  3. Follow the prompts to create the SSH key (default location: ~/.ssh/id_ed25519 for the private key and ~/.ssh/id_ed25519.pub for the public key).

  4. Add your SSH key to the SSH agent:

     eval "$(ssh-agent -s)"
     ssh-add ~/.ssh/id_ed25519
    
  5. Copy your SSH public key to your clipboard:

     pbcopy < ~/.ssh/id_ed25519.pub
    
  6. Go to your GitHub account settings, navigate to SSH and GPG keys, and click New SSH key. Paste your public key there and save it.

4. GitHub Account

If you don’t have a GitHub account, sign up for one at GitHub.

5. Create a Repository

Create a new repository on GitHub by clicking the New button on the main page of your GitHub account.

6. Clone a Repository (Optional)

To work with an existing repository, clone it to your local machine:

git clone <repository_url>

Replace <repository_url> with the URL of the GitHub repository you want to clone.

7. Start Using Git and GitHub

You are now set up to use Git and GitHub on your Mac. Use the git command to manage your code, and push and pull changes to and from your GitHub repositories.

Notes

Remember to replace placeholders like Your Name, youremail@example.com, and <repository_url> with your actual information.


Thank you for reading until the end.
Before you go please consider supporting by giving a Hart, Share, or Follow! 👏

Share On Social: