Connect to GitHub using SSH

Source: Internet
Author: User
Tags dns spoofing

GitHub every time Pull/push code to require the user to push code is legal, so each push time to enter the account password to verify whether the user is a legitimate user, and SSH is a secure transmission mode, can replace the user's "Enter account password" behavior to verify the user.

Two ways to operate on GitHub
    1. Https

      You can clone a project on GitHub at will, no matter who it is, and you need to verify your username and password at Pull/push.
    2. Ssh

      The clone must be a user or administrator, and you will need to add SSH key before cloning. Instead of validating the user name and password at Pull/push, the user is authenticated by validating SSH.

SSH (Secure Shell protocol)

Defined:

SSH is the abbreviation for secure Shell, which is developed by the IETF Network Working Group, and SSH is a security protocol based on the application layer and the transport layer. SSH is currently a more reliable protocol that provides security for Telnet sessions and other network services. The use of SSH protocol can effectively prevent the information leakage in the remote management process. SSH was originally a program on a UNIX system, and later expanded quickly to other operating platforms. SSH can compensate for vulnerabilities in the network when it is used correctly. The SSH client is available on a variety of platforms. Almost all UNIX platforms-including HP-UX, Linux, AIX, Solaris, Digital UNIX, Irix, and other platforms-can run SSH. --Baidu Encyclopedia

Function:

Traditional Web services such as FTP, pop, and telnet are inherently insecure because they transmit passwords and data in plaintext on the network, and it is very easy for an ulterior motive to intercept the passwords and data. Moreover, the security authentication methods of these service programs also have their weaknesses, that is, it is very easy to be attacked by the "man in the Middle" (man-in-the-middle) way.
The so-called "middleman" attack,

Client--"impersonating the server (middleman)--" The real server

The "Middleman" pretends to be a real server to receive the data you pass to the server and then impersonate you to pass the data to the real server .
The data transfer between the server and you is a very serious problem after the hands and feet of the "middleman". By using SSH, you can encrypt all the transmitted data so that the "man-in-the-middle" attack is not possible, and it can prevent DNS spoofing and IP spoofing. An additional benefit of using SSH is that the transmitted data is compressed so that the transfer speed can be speeded up. SSH has many functions, which can replace Telnet and provide a secure "channel" for FTP, PoP, and even PPP. --Baidu Encyclopedia

Use steps
  1. To see if an SSH key already exists

    Open git bash, enter

    $ cd ~/.ssh$ ls

    If this directory does not exist, then take the second step, otherwise, you have the SSH public key and private key, you can skip the second step, directly into the third step.

  2. Generate an SSH secret key

    "[email protected]"
    Code parameter meaning:
    • -t specifies the key type, which is RSA by default and can be omitted.
    • -C Set comment text, such as mailbox.
    • -f Specifies that the key file stores the file name.

    According to the prompt, you need to specify the file location and password, if you are comfortable enough, in fact, you can directly enter, do not need any password. When you are done, you can see the files you just generated under the/c/users/you/.ssh/path: Id_rsa and Id_rsa.pub. That is, the public and private keys.

  3. Add a public key to your GitHub account

    • Log in to your GitHub, Avatar drop-down box to select Settings.
    • Go to the Settings page and click the Sidebar SSH and GPG keys button.
    • Click New SSH key , title can be filled in, and the contents of the id_rsa.pub generated in the previous step are copied into the key input box here.
  4. Confirm

    $ ssh -T [email protected]

    Here I get a hint:

    Warning:permanently added the RSA host key for IP address ' 192.30.253.113 ' to the list of known hosts.

    Enter directly, and finally see this to show that you are done:

    Hi username! You've successfully authenticated, but GitHub does not provide shell access.

Problems encountered

After adding the public key, use the small turtle (tortoisegit) Pull code times wrong:

No supported authentication methods aviaible (server Sent:publickey)

Checked, and found that because of the conflict between Tortoisegit and git, we need to correct the Tortoisegit settings as follows.

    • Right-click Tortoisegit, Settings, Network
    • Point SSH client to ~\git\usr\bin\ssh.exe (under Git installation path)

Http://www.cnblogs.com/yzg1/p/5773362.html

Connect to GitHub using SSH

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.