When pushing projects to GitHub using the HTTPS method, you need to enter your username and password every time, which is very troublesome. However, by using the SSH method, this is no longer necessary. You only need to configure an SSH key in your GitHub account.
1. Check if an SSH key already exists on your local machine#
Press Win + R to open the Run dialog, type cmd to open the command line.

Enter the following commands:
cd .ssh
dir
If the files id_rsa and id_rsa.pub exist, it means you already have an SSH Key. The image below indicates they exist.

If they exist, proceed directly to step three.
2. Generate an SSH key#
If they do not exist, generate one using the following command.
ssh-keygen -t rsa -C "xxx@xxx.com"
// Replace "xxx@xxx.com" with your own GitHub email address
Press Enter for all prompts.
3. Get the public key content (id_rsa.pub)#
cd .ssh
type id_rsa.pub
// Windows command line
cat id_rsa.pub
// Linux command line
As shown in the image below, copy this content.

4. Add the public key to your GitHub account#
- Click your profile picture in the top right corner, go to Settings, and add SSH Keys.

- Paste the content you just copied.

5. Verify if the setup was successful#
ssh -T git@github.com
If successful, it will display something like this:

Once successfully set up, you can clone and push code without needing a username and password.
Note: After this, when cloning repositories, use the SSH URL, not HTTPS!
