DEV Community

Gabriel Braz
Gabriel Braz

Posted on • Updated on

Generating a new SSH key for Github projects

Introduction

In this article I'll say about how to create a new ssh key and provide it on cloud for to be safe in our applications and softwares. It's can became easily for make safely connections remotely from your machine as git pull/push.

Get started

  • Open the terminal and paste the text below, substituting in your GitHub email address.
$ ssh-keygen -t ed25519 -C "your_email@example.com"
Enter fullscreen mode Exit fullscreen mode

Note: If you are using a legacy system that doesn't support the Ed25519 algorithm, use:

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Enter fullscreen mode Exit fullscreen mode

It creates a new SSH key, using the provided email as a label.

Generating public/private algorithm key pair.

  • When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
Enter a file in which to save the key (/Users/you/.ssh/id_algorithm): [Press enter]
Enter fullscreen mode Exit fullscreen mode

At the prompt, type a secure passphrase. For more information, see "Working with SSH key passphrases."

> Enter passphrase (empty for no passphrase): [Type a passphrase]

> Enter same passphrase again: [Type passphrase again]
Enter fullscreen mode Exit fullscreen mode

Notes:

In the terminal, access until to path /.ssh and then run commands there. Also it’s important to say that email from first command generation is you personal account of Github.

Its there is’t need typing password because we will use pull request only, and not push.

In the Github, you can put empty title for create key.

Fonts:
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key

Adding a new SSH key to your GitHub account

Fonts:
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account

How to Clone a Specific Branch

git clone --branch <branchname> <remote-repo-url>

Top comments (0)