Mastering GitHub Access with SSH: A Game-Changer for DevOps Enthusiasts

 Hello, I’m Raees Qazi, Founder and CEO of Briller Technologies. As an ever-evolving learner in the world of DevOps and automation, I constantly seek innovative ways to optimize my workflows and enhance productivity. Today, I’m excited to share with you a powerful technique for accessing GitHub repositories that I recently discovered — using SSH (Secure Shell).

In a previous blog, I explored the use of Personal Access Tokens (PAT) for GitHub authentication. Now, let’s take it a step further by diving into SSH, a more secure and seamless method to connect to GitHub.


What is SSH?

SSH, or Secure Shell, is a cryptographic network protocol that provides a secure method for accessing and managing remote machines over an unsecured network. By using SSH, you can securely communicate with GitHub without the need to enter your username and password every time.

Why SSH?

SSH authentication is more secure than traditional methods and simplifies your workflow. It involves generating a public/private key pair and linking it with your GitHub account. Once set up, you can securely clone repositories, push changes, and pull updates — all without re-entering credentials.

How to Set Up SSH with GitHub

Let me walk you through the steps to set up SSH keys for seamless GitHub access:

Step 1: Generate SSH Keys

First, you need to create a public and private key pair on your local machine. Open your terminal and run the following command:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

This will generate a public and private key in your local machine’s .ssh directory.

Step 2: Add the Public Key to GitHub

  1. Log in to GitHub: Head to GitHub and log in with your credentials.
  2. Navigate to Settings: In the top-right corner of the page, click your profile picture and select Settings.
  3. Go to SSH & GPG Keys: On the left sidebar, click SSH and GPG keys.
  4. Add New SSH Key:
  • Click New SSH Key.
  • Give the key a recognizable title (e.g., “My Laptop’s SSH Key”).
  • Paste the public key you generated earlier into the field provided. You can find your public key in the .ssh/id_rsa.pub file on your local machine.

Step 3: Clone a Repository via SSH

Once your SSH key is added to GitHub, you’re ready to clone repositories using SSH instead of HTTPS. To do this, run:

git clone <ssh-url-of-repository>

You’ll find the SSH URL of your repository under the Code button on GitHub.

Step 4: Push and Pull Changes Securely

Now that your SSH connection is set up, you can push and pull changes from your local machine to GitHub without the need for authentication each time. Simply use the standard Git commands:

git push origin main
git pull origin main

The Magic on Your Screen

Once these steps are complete, you’ll witness the magic unfold as your local machine and GitHub repository become seamlessly connected through SSH. This method enhances both your workflow and security, giving you a smoother development experience.

I hope you found this guide useful. As I continue to explore and learn, I’ll share more insights into the world of DevOps and automation. Stay connected with me on this exciting journey, and let’s continue learning together!

This version aims to sound more professional and engaging while clearly explaining each step involved in setting up SSH with GitHub.

Here is the YouTube Link: https://youtube.com/@raeesq.?si=v_QK6Q2XXMf9mKep

Thanks for reading!

Comments

Popular posts from this blog

📘 Understanding Prometheus in a Simple Way-Part 3 (For DevOps Beginners)

Grafana Setup & Dashboard Creation (Part-5)— Explained by Raees Yaqoob Qazi

My First Python Program: A Simple Calculator