Add SSH keys for your github account (Linux and Windows)

Source: Internet
Author: User

Article turned from : HTTPS://BLOG.COFFACE.COM/ARCHIVES/406.HTML/2

First, the Linux add SSH keys method:

When synchronizing a code base on GitHub from GitHub using the git clone command, if you use SSH links (such as my own Cofface_recovery project: [Email Protected]:cofface/cofface_ Recovery.git), and your SSH key is not added to your GitHub account settings, the system will report the following error:
Permission denied (PublicKey).
Fatal:the remote end hung up unexpectedly
You will need to create an SSH key locally and then add the generated SSH key file content to your GitHub account.
The way to create SSH keys is simple, and you can do this by following these commands:

Ssh-keygen

Then the system prompts for information such as file save location, three consecutive hit enter, the generated SSH key file saved in the ~/.ssh/id_rsa.pub
Then open the file with the text Editing tool, I use VIM, so the command is:

Gedit ~/.ssh/id_rsa.pub

Then copy the content in the. ssh/id_rsa.pub file and paste it into the Add SSH key interface in GitHub account management.
To open the Add SSH key interface in GitHub account management, follow these steps:
1. Login to GitHub
2. Click the Accounting settings icon in the top right
3. Select SSH Key
4. Click Add SSH Key
In the interface that appears, fill in the name of the SSH key, fill in a name you like, and then paste the contents of the ~/.ssh/id_rsa.pub file into the key column, click on the "Add Key" button.
Add a process github will prompt you to enter your GitHub password once
After adding it, execute git clone again to successfully clone the code base on GitHub.


Second, the Windows Add SSH keys method:
1, install Git Bash;
2. Use the git bash command:

Ssh-keygen-t rsa-c "[Email protected]"

#建议填写自己真实有效的邮箱地址, then press the ENTER key all the way
3, then enter the C:\Users\ user name \.ssh directory, find the Id_rsa.pub file, copy the content inside the GitHub add SSH key interface can be.

Add SSH keys for your github account (Linux and Windows)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.