To Enable SSH into GitHub from an EC2 instance using SSH Keys

To Enable SSH into GitHub from an EC2 instance using SSH Keys

To SSH into GitHub from an EC2 instance, you need to set up SSH keys and configure your GitHub account with the public key. Here's a step-by-step guide to help you through the process:

  1. Create an EC2 instance: Launch an Amazon EC2 instance if you haven't already. Make sure you have the necessary access credentials (key pair) to connect to the instance via SSH.

  2. Connect to the EC2 instance: Use an SSH client to connect to your EC2 instance.

  3. Execute ssh-keygen as shown above.

  4. Add the public key to your GitHub account: After generating the SSH key pair, you need to add the public key to your GitHub account. Use the cat command to display the contents of the public key file (~/.ssh/id_rsa.pub by default) and copy the output.

  5. cat ~/.ssh/id_rsa.pub

  6. Now in your GitHub, go to your code and select ssh and copy.

  7. GiTclone using the SSH path and you can see it is successful as shown above.

  8. Git commit is done.

  9. Using Git push to push code from local to repo (GitHub) and you can see PAT (Personal Access Token) is not required.