Using SSH (Password Less)

To use SSH to push to a Git repository without entering a password every time, you can set up SSH keys between your local machine and the remote repository

ssh-keygen

Generate an SSH key pair on your local machine using the ssh-keygen command. This command will create a public and private key pair.

ssh-keygen -t rsa

This will create a new SSH key pair

Add your public key to your Git account

This involves copying the contents of the public key file (~/.ssh/id_rsa.pub) and pasting it into the SSH keys section of your Git account settings.

  1. Open a web browser and navigate to GitHub.com.

  2. Sign in to your GitHub account.

  3. Click on your profile icon in the top right corner of the screen.

  4. Click on "Settings" in the dropdown menu.

  5. In the left-hand menu, click on "SSH and GPG keys".

  6. Click on the "New SSH key" button.

  7. Give your new key a title that will help you identify it later.

  8. Paste the contents of your public SSH key into the "Key" field on the GitHub website.

  9. Click the "Add SSH key" button.

Configure the Git repository to use SSH

Change the remote URL for your Git repository to use the SSH URL instead of the HTTPS URL.

git remote set-url origin git@github.com:username/repo.git

Last updated