Open In App

How to Generate Public SSH or GPG Keys using Git Commands?

Last Updated : 31 Aug, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

When working with a GitHub repository, you’ll often need to identify yourself to GitHub using your username and password. An SSH key is an alternate way to identify yourself that doesn’t require you to enter your username and password every time. SSH keys come in pairs, a public key that gets shared with services like GitHub, and a private key that is stored only on your computer. If the keys match, you’re granted access. The cryptography behind SSH keys ensures that no one can reverse engineer your private key from the public one. As SSH/GPG keys are used to authenticate and establish an encrypted communication channel between a client and a remote. So there is a need of creating and adding them to your GitHub account to make it secure and easy in pushing locally etc.

Steps to Generate SSH Key

First, open your Git Bash terminal. Now, just run the following commands to get your keys. Type ssh-keygen -o and then press enter. It will ask, for some confirmations, just press Enter, y, Enter, Enter respectively.

Generate SSH Key

 

Type cat ~/.ssh/id_rsa.pub and then press enter. It will automatically generate your SSH key (it starts with “ssh-rsa”). Now copy the key and Add it as a “New SSH key” present there in the SSH and GPG keys section of your Github profile setting.

 Generate SSH Key

 

Now you’re good to go. 


Similar Reads

Difference Between Git remote prune, Git prune and Git fetch --prune
One of the great things about Git is that it's *very careful about deleting data*. This makes it pretty hard to lose commits or other valuable data in Git! A small downside of this is that you might sometimes see stale data that you actually don't need anymore. One of the best examples of this is references to remote branches that have already been
2 min read
How to Push Folders From Local PC to GitHub using Git Commands?
Git offers a powerful command-line interface for managing code repositories, understanding how to push folders from your local PC to GitHub repositories using Git commands can enhance your workflow and streamline the process of sharing code with collaborators or deploying projects. In this article, we'll see the step-by-step process of pushing fold
2 min read
Useful Git Commands and Basic Concepts
Open Source Development is an amazing platform for everyone, whether you are a Developer, an Open Source Enthusiast, or if you are a beginner who wants to do real-world Software Development. Now if you are looking to contribute to Open Source then you must have a working knowledge about Git and Github. Now, Git is a Software that is used as a Versi
6 min read
Basic Git Commands with Examples
Nowadays open source contribution is on the peak. It's getting so much popular among students and there are also some open-source programs and competitions to learn so much about development. Open source is a great way to learn and make a better community. There are so many organizations where one can contribute and learn. For that one have to know
3 min read
Simple and Concise Git Commands That Every Software Developer Should know
As developer git is the most useful arena which is not operated directly so do we have git commands that become very crucial that one should know after having git installed in the local system. if not you must download git from here Download Git. If you need any help with the further installation process. So, Now let's start with the basic commands
4 min read
Essential Git Commands
When it comes to commands, there come numerous commands in a software developer head or one that is mastering over git but even only a few of them are used frequently in the enterprising domains that are used frequently by developers in order to boost workflow. So here we will be listing a couple of them prior to dividing them into categories in or
3 min read
How to Use Git Commands in Android Studio Terminal?
Android Studio is the official IDE (Integrated Development Environment) for Android app development and it is based on JetBrains’ IntelliJ IDEA software. Git is a Distributed Version Control System. It is used in Software Development. Git was developed by Linus Torvalds in the year 2005 to manage the development of the Linux Kernel Need of Git Git
2 min read
Top 20 Git Commands to Become a Pro Developer
Git is a distributed version control system and open-source software used by developers to manage different versions of source code by tracking changes in files. It is used by developers to work together on the same project from anywhere. Whether you are a professional developer or just starting your coding journey, Git is essential for becoming a
8 min read
Top 12 Most Used Git Commands For Developers
Git is a distributed version control system and open-source software. It enables developers to manage many versions of a source code with ease. You can use it to figure out who did what, when, and why. Git has become a must-have tool for any developer nowadays, and knowing Git commands is required for developers to fully utilize Git. There are hund
6 min read
All Git Commands You Should Know
Git is a distributed version control system (VCS) that allows multiple developers to work on a project at a time, giving the possibility of changing each other's work based on requests and authorizations. Created by Linus Torvalds in 2005 for the development of the Linux kernel, Git has since become the most widely used version control system in th
8 min read
Article Tags :