Skip to content
Khoa Pham@onmyway133

How to login to GitHub using SSH

1 min read

SSH

https://help.github.com/en/articles/which-remote-url-should-i-use#cloning-with-ssh

SSH URLs provide access to a Git repository via SSH, a secure protocol. To use these URLs, you must generate an SSH keypair on your computer and add the public key to your GitHub account. For information on setting up an SSH keypair, see “Generating an SSH key.”

ssh-keygen -t rsa -C "onmyway133@gmail.com"
pbcopy < ~/.ssh/id_rsa.pub

Go to Settings -> SSH and GPG keys https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account

Personal access token

https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line

Personal access tokens can only be used for HTTPS Git operations. If your repository uses an SSH remote URL, you will need to switch the remote from SSH to HTTPS.

$ git clone https://github.com/username/repo.git
Username: your_username
Password: your_token

Type to search titles and full text.

↑ ↓ move↵ openPagefind