How to setup Github push with SSH Keys
Every you push a commit to your repository, you usually have to enter your username and password. It will take much time and effort, In this post, i show you how to push your commit without enter username and password using ssh keys. So how to do it.
Generating a new ssh key.
Open your terminal Paste the text below, substituting in your GitHub email address.
This creates a new ssh key, using the provided email as a label. When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the default file location. At the prompt, type a secure passphrase.
Adding your ssh key to the ssh-agents
Start the ssh-agent in the background.
Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.
Adding a new SSH key to your GitHub account
Copy the SSH Key to your clipboard. in this case, I using xclip tools to copy some text in terminal to my clipboard. so you have to install xclip by typing the following command in your terminal.(I use Ubuntu OS, adjust with your os)
In the upper-right corner of any page, click your profile photo, then click Settings.
In the user settings sidebar click SSH and GPG keys.
Click New SSH key or Add SSH key.
In the “Title” field, add a descriptive label for the new key. For example “My Ubuntu”.
Paste your key into the “Key” field. then, click Add SSH key.
If prompted, confirm your GitHub password.
Configure you Github Repository
In your terminal, go to your repository directory, then typing the following command. Adjust with your repository address.