MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
Setting up SSH Keys, Personal Access Tokens (PAT) and Authentication0%
Study Materials
Git & GitHub BasicsProgress 0%
1.1What is Version Control? (Local, Centralized vs Distributed VCS)1.2Why Git? History, Architecture & Core Benefits1.3The Three Trees: Working Directory, Staging Area & Git Repository1.4Installing Git and Initial Configuration (git config user.name / email)
5.1What is GitHub? Remote Hosting, Social Coding & Open Source5.2Setting up SSH Keys, Personal Access Tokens (PAT) and Authentication5.3Creating a Remote Repository and Connecting with git remote add5.4Pushing and Pulling Code: git push -u origin main and git pull
HomeTutorialsGit & GitHub BasicsSetting up SSH Keys, Personal Access Tokens (PAT) and Authentication
Creating a Remote Repository and Connecting with git remote add

Setting up SSH Keys, Personal Access Tokens (PAT) and Authentication

Beginner12 min read•Updated: 2026-09-15•By Er. Sumit Kumar (MSK Institute)
Study MaterialsCheatsheet

To push code from your local machine to GitHub, Git must authenticate your identity. In August 2021, GitHub permanently removed support for plain account passwords when authenticating Git operations over HTTPS. Today, you must authenticate using either SSH Keys (recommended) or Personal Access Tokens (PAT).


1. Why Password Authentication Was Deprecated

Plain text passwords suffer from major security flaws:

  • They can be intercepted, shoulder-surfed, or phished.
  • A leaked password grants full access to your entire GitHub account.
  • They cannot be easily scoped or set to expire automatically.

Modern Solutions:

  1. 1
    SSH (Secure Shell) Keys: Cryptographic public/private key pairs. Zero passwords to type; permanently secure and lightning fast.
  2. 2
    Personal Access Tokens (PAT): Scoped, revocable alphanumeric strings used as password replacements over HTTPS.

2. Generating and Configuring SSH Keys (Recommended)

SSH uses asymmetric public-key cryptography. You keep the private key secret on your laptop, and upload the public key (.pub) to GitHub.

Step 1: Check for Existing SSH Keys

1ls -al ~/.ssh
2# Look for id_ed25519 or id_rsa

Step 2: Generate a Modern Ed25519 Key Pair

The Ed25519 algorithm is faster and more secure than legacy RSA:

1ssh-keygen -t ed25519 -C "sumit@mskinstitute.com"
  • Press Enter to accept the default file location (~/.ssh/id_ed25519).
  • Enter a passphrase for extra local security (or press Enter for no passphrase).

Step 3: Add Your Private Key to the SSH Agent

1# Start ssh-agent in the background
2eval "$(ssh-agent -s)"
3 
4# Add your private key
5ssh-add ~/.ssh/id_ed25519

Step 4: Copy Your Public Key to Clipboard

1# On Windows PowerShell:
2Get-Content ~/.ssh/id_ed25519.pub | Set-Clipboard
3 
4# On macOS:
5pbcopy < ~/.ssh/id_ed25519.pub
6 
7# On Linux:
8cat ~/.ssh/id_ed25519.pub

Step 5: Add Public Key to GitHub

  1. 1
    Log in to GitHub -> Click your profile avatar -> Settings.
  2. 2
    Under "Access", click SSH and GPG keys -> Click New SSH key.
  3. 3
    Provide a title (e.g. Work Laptop Windows 11).
  4. 4
    Key type: Authentication Key.
  5. 5
    Paste your copied public key into the Key box and click Add SSH key.

Step 6: Test Your SSH Connection

1ssh -T git@github.com

Expected success output:

1Hi sumit-msk! You've successfully authenticated, but GitHub does not provide shell access.

3. Alternative: Personal Access Tokens (PAT)

If your corporate firewall blocks outgoing SSH port 22, you can use HTTPS with a Personal Access Token:

  1. 1
    On GitHub, go to Settings -> Developer Settings -> Personal Access Tokens -> Tokens (classic).
  2. 2
    Click Generate new token (classic).
  3. 3
    Set an expiration (e.g., 90 days) and check the repo scope.
  4. 4
    Copy the token string immediately (e.g., ghp_xxxxxxxxxxxx).
  5. 5
    When Git prompts for your password in the terminal, paste the PAT string instead of your GitHub password.

Interactive Quiz• Knowledge Check

Practice Quiz

Question 1
Why did GitHub deprecate password authentication for Git operations in 2021?
Question 2
In asymmetric SSH cryptography, which key must remain strictly private and never be shared or uploaded to GitHub?
Question 3
Which command generates a secure, modern Ed25519 SSH key pair?
Question 4
How do you verify that your SSH key is successfully authenticating with GitHub?
Question 5
If you use HTTPS URLs (e.g. https://github.com/user/repo.git), what must you provide when Git prompts for your password?
Next Lesson

Creating a Remote Repository and Connecting with git remote add

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
What is GitHub? Remote Hosting, Social Coding & Open SourceCreating a Remote Repository and Connecting with git remote add

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

Mentor-Led Practical Training

Master Git & GitHub Basics with Hands-On Projects

Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext