Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Git Tutorial
  • Git Exercises
  • Git Basic Commands
  • Git Cheat Sheet
  • Git Interview Questions
  • Git Bash
  • GitHub
  • Git Branch
  • Git Merge
  • Git WorkFlow
  • Git Hooks
  • Git LFS
  • Git Rebase
  • Git Cherry Pick
Open In App
Next Article:
Using GitHub with SSH (Secure Shell)
Next article icon

Using GitHub with SSH (Secure Shell)

Last Updated : 21 Apr, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
Secure Shell (SSH) Protocol facilitates the communication among systems in an unsecured network by providing a secure channel over it. It safeguards the connection to remote servers enabling user authentication. Using SSH, you can connect to your GitHub account eliminating the need of giving username and password each time you push changes to the remote repository. The integration process involves setting up SSH Keys within both the local and remote systems.

Connect to GitHub using SSH

Note: If you already have an existing SSH key, you can skip step 1 and go to step 2. You can verify the same by listing all the existing keys using the command:
 $ ls -al ~/.ssh 
Steps to connect GitHub to SSH :
Step 1: Generate SSH Key on Local System
  • Launch Terminal / Git Bash.
  • Paste the below command and substitute your GitHub email address:
     $ ssh-keygen -t rsa -b 4096 -C "[email protected]" 
  • Press Enter when prompted "Enter a file in which to save the key".
  • Type a passphrase of your choice.
  • Verify creation of SSH Key:
     $ ls -al ~/.ssh 
Step 2: Add SSH Key to SSH Agent
  • Initiate ssh-agent:
     $ eval "$(ssh-agent -s)" 
  • If your key is generated with a different name, replace id_rsa in the command below:
     $ ssh-add ~/.ssh/id_rsa 
Step 3: Add the SSH Key to your GitHub Account
  • Copy key to the clipboard:
      WINDOWS  $ clip < ~/.ssh/id_rsa.pub    LINUX  $ sudo apt-get install xclip  $ xclip -sel clip < ~/.ssh/id_rsa.pub    MAC  $ pbcopy < ~/.ssh/id_rsa.pub  
  • Open the GitHub website and log in to your account. Go to the settings page from the menu in top right corner.
  • Select "SSH and GPG keys" from the sidebar and click on "New SSH key" option.
  • Add relevant title in the "Title" field and paste the SSH key in the "Key field".
  • Now, click on "Add SSH key".
Step 4: Test the SSH Connection
  • Launch Terminal / Git Bash.
  • Type:
     $ ssh -T [email protected] 
  • Connection is established if you are prompted with the following message:
    Hi {username}! You've successfully authenticated, but GitHub does not provide shell access.

Next Article
Using GitHub with SSH (Secure Shell)

C

cs_apachi
Improve
Article Tags :
  • Git

Similar Reads

    Using GitHub to Host a Free Static Website
    Having a personal or project website is important for showcasing your work. Fortunately, GitHub Pages offers a simple and free solution for hosting static websites directly from your GitHub repositories. In this article, we'll walk you through the process of creating and hosting a static website usi
    3 min read
    How To Use Multiple Users With Git?
    Git is an important tool for version control in software development. Whether you are contributing to open-source projects, working on personal projects, or part of different organizations, managing multiple Git users becomes necessary. In this article, we will learn how To Use Multiple Users With G
    3 min read
    Integrating Jenkins With Popular GitHub
    When you push the code into GitHub, you have to manually trigger builds and assessments every time. It's like building a sandcastle one grain at a time. This can be time-consuming and inefficient. Fortunately, Jenkins and GitHub are a dynamic pair that can take you to a world of computerized continu
    8 min read
    Push Codes from Linux (UBUNTU) To GitHub using SSH KEY
    GitHub, one of the most popular platforms for version control and collaboration, offers multiple authentication methods for interacting with repositories. SSH keys provide a secure and convenient way to authenticate and push code from a local machine to GitHub. In this article, we'll learn the step-
    4 min read
    Jenkins and GIT Integration using SSH Key
    Integrating Jenkins with Git using SSH keys is a powerful way to automate your Continuous Integration (CI) and Continuous Deployment (CD) pipelines while ensuring secure access to your Git repositories. In this article, we'll guide you through the process of setting up Jenkins to work seamlessly wit
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences