GitHub Add SSH Authentication

Source: Internet
Author: User
Tags account security using git

General overview: When using Git, there are two ways to https,ssh a relationship with a target repository. HTTPS authentication is generally used (this is simple and convenient), but there is a drawback, pull,push and other operations need to enter user authentication frequently. Although the user authentication account password can be saved locally (this will lead to a new problem, local storage using plaintext-sourcetree), this time can be connected by SSH, can simultaneously solve the user frequent authentication and account security issues

Implementation steps (Windows7 environment)

1 first locally installed git, specific Baidu

2 Generate Public Private key

SSH-KEYGEN-T RSA

-t specifies the key type, which is RSA by default and can be omitted.
-C Set comment text, such as mailbox.
-f Specifies the key file Store file name

The above command omits the-C,-f parameter, so you will be prompted to enter a file name to save the generated ciphertext after running the command , then prompted to enter two password (for the push operation to enter the password, if not set, push without the need to enter password verification, directly submitted)

The public key file is then generated in the user's home directory

3 Login to GitHub and add the public key (is_rsa.pub) content to SSH key

4 Add private key to the cache Ssh-agent (the second step is to set the password)

Ssh-add ~/.ssh/id_rsa

If you cannot add directly to the ssh-agent, you can do so.

ssh-agentis a special program designed for both pleasant and secure processing of RSA and DSA keys, which is included in the OpenSSH distribution (see part 1th of this series for an introduction to RSA and DSA certifications). Unlike ssh , a ssh-agent long-running Daemon (daemon), the only purpose for which it is designed is to cache the decrypted private key

5 test SSH

Ssh-t git@github.com

Output the following similar tips to demonstrate authentication success

6 Checking out git repository

Check out repository There are two ways, https,ssh, pay attention to choose the way ssh, or push still need user name password Authentication

git clone xxx

First blog, have questions to welcome correct, study together

GitHub Add SSH Authentication

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.