Skip to content

Latest commit

 

History

History
84 lines (55 loc) · 1.38 KB

SSH.md

File metadata and controls

84 lines (55 loc) · 1.38 KB

SSH Keys

Create New SSH Keys

Check whether SSH Keys are already present on your Computer

ls -a -l ~/.ssh

If id_rsa and id_rsa.pub are present, that means SSH keys are already present. If not then only add new SSH Keys.

Add New SSH Keys

ssh keygen -t rsa -b 4096 -C "{email-id}@gmail.com"

Press Enter every time.

Authenticate SSH Connection to GitHub

Print the Public Key inside terminal

cat ~/.ssh/id_rsa.pub

Copy selected text and add it to GitHub. Follow these steps:

  1. Click Profile Icon
  2. Select Settings
  3. Select SSH and GPG Keys
  4. Click New SSH key
  5. Add Title and Copy all the contents of cat command
  6. Submit Add SSH Key

Authenticate (or Test Old) New SSH Connections

Add Key to a Git Repository

Open Git Repository Locally

cd {my-git-repository}

Start the SSH agent in the background

eval $(ssh-agent -s)

Note: Make Sure that the SSH Keys are already created.

Add key to the opened repository

ssh-add ~/.ssh/id_rsa

Add Remote to Git Repository

git remote add origin https://github.com/{username}/{my-git-repository}.git

Test SSH Connections or Authenticate New Connections

Then type yes to confirm.

Push Code to GitHub

git push -u origin master