Git Ready Part 2

Now that we have the empty remote repo copied to the local repo, we neet to take care of one more very important thing before we can start pushing code to remote.

When you attempt to push code to GitHub without completing the steps that I am going to lay out for you, you will more than likely receive this error message:

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. fatal: Authentication failed for 'https://github.com/username/repo.git/'

To prevent this we are going to push code via SSH

What is SSH?: SSH (Secure Shell) is a cryptographic network protocol for securely accessing and managing remote systems over an encrypted connection.

Setting up SSH (Linux + Mac)

  1. Generate SSH Key:
  2. Run ssh-keygen -t ed25519 -C "your_email@example.com" in the terminal.
  3. Press Enter to accept the default location.

  4. Start SSH Agent:

  5. Run eval "$(ssh-agent -s)" to start the SSH agent.

  6. Add SSH Key:

  7. Run ssh-add ~/.ssh/id_ed25519 to add the key.

  8. Copy SSH Key:

  9. Run cat ~/.ssh/id_ed25519.pub and copy the output.

  10. Add SSH Key to GitHub:

  11. Go to GitHub > Settings > SSH and GPG keys > New SSH key.
  12. Paste the key and save.

  13. Test Connection:

  14. Run ssh -T git@github.com to verify the connection.

  15. Set SSH Remote URL:

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

You're now ready to push code to GitHub using SSH!