Make sure there is at least one file in it (e.g., README.md).
Generate a new SSH key using RSA:
ssh-keygen -t rsa -C "[email protected]"Generate a new SSH key using RSA with even better security:
ssh-keygen -t rsa -b 4096 -C "[email protected]"Generate a new SSH key using ED25519:
ssh-keygen -t ed25519 -C "[email protected]"Bash or MacOS:
touch ~/.ssh/configWindows:
type nul > ~/.ssh/configAdd the following content to the config file:
Host *
  AddKeysToAgent yes
  IdentityFile ~/.ssh/[key_generate_file]
or you can specific host
Host github.com
  HostName github.com
  User git
  IdentityFile ~/.ssh/[key_generate_file]
Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings (https://github.com/settings/keys).
Paste the contents of your SSH public key into your GitHub account settings (https://github.com/settings/keys).
Run the following command to test your SSH key setup:
ssh -T [email protected]result:
Hi [Your GitHub Name]! You've successfully authenticated, but GitHub does not provide shell access.Change directory into the local clone of your repository (if you're not already there) and run:
git remote set-url origin [email protected]:username/your-repository.gitNow try editing a file (e.g., README) and then do:
git add .
git commit -m "Update README.md"
git pushIf it works without asking for a username or password, your SSH key is correctly configured. β
wget https://gist.github.com/PunGrumpy/d0e2557b5e3aa3251987b37b9c333ac8/raw/2488cc971b83e693cd209f628ff6e4a3b6d3efc9/generate_ssh_key_pair.sh -O generate_ssh_key_pair.shchmod +x generate_ssh_key_pair.sh./generate_ssh_key_pair.shI hope you find these changes helpful! Let me know if you have any further questions or suggestions. Happy coding! π