Configure SSH Connection under window github, GitHub config ssh key (go)

Source: Internet
Author: User
Tags custom name


From: http://jingyan.baidu.com/article/a65957f4e91ccf24e77f9b11.html
This experience is divided into two parts:
The first part introduces: configure SSH Keys to connect to GitHub through msysGit (Git for windows, Git Bash) under windows.

The second part introduces: Create a warehouse on GitHub, create a project locally, and then submit the local project to the GitHub warehouse through SSH. Tools / raw materials

GitHub

msysGit (git for windows, Git Bash)

msysGit configures SSH to access GitHub
1

Check if the machine has ssh key setting

$ cd ~ / .ssh or cd .ssh

If not, it will prompt: No such file or directory

If there is, enter the ~ / .ssh path (ls to view the current path file, rm * delete all files)

2

1. Use Git Bash to generate a new ssh key.

$ cd ~ #Ensure that the current path is under "~"

$ ssh-keygen -t rsa -C "[email protected]" #It is recommended to fill in your real and effective email address

Generating public / private rsa key pair.

Enter file in which to save the key (/c/Users/xxxx_000/.ssh/id_rsa): #Enter directly without filling

Enter passphrase (empty for no passphrase): #Enter password (can be empty)

Enter same passphrase again: #Confirm password again (can be empty)

Your identification has been saved in /c/Users/xxxx_000/.ssh/id_rsa. #Key generated

Your public key has been saved in /c/Users/xxxx_000/.ssh/id_rsa.pub. #Generated public key

The key fingerprint is:

e3: 51: 33: xx: xx: xx: xx: xxx: 61: 28: 83: e2: 81 [email protected]

* The machine has completed the ssh key setting, and its storage path is: c: /Users/xxxx_000/.ssh/.

Note: A key with a custom name of ssh key can be generated. The default id_rsa.

$ ssh-keygen -t rsa -C "email address" -f ~ / .ssh / githug_blog_keys #The name of the generated ssh key is githug_blog_keys, and other exceptions may occur when used with caution.

3

Add ssh key to GItHub

3.1 Log in to the GitHub system; click “▼” → Settings → SSH kyes → Add SSH key in the account picture in the upper right corner.

4

3.2 Copy the content of the public key of id_rsa.pub.

1) Go to the c: /Users/xxxx_000/.ssh/ directory, open the id_rsa.pub file, and copy all public key contents.

2) Customize Title, paste the public key into the key input box of Add an SSH key in GitHub, and finally "Add Key".

5

Configure account

$ git config --global user.name "your_username" #Set user name

$ git config --global user.email “your_registered_github_Email” #Set email address (recommended to use giuhub registered email)

6

Test whether ssh keys are set successfully.

$ ssh -T [email protected]

The authenticity of host ‘github.com (192.30.252.129)’ ca n’t be established.

RSA key fingerprint is 16: 27: xx: xx: xx: xx: xx: 4d: eb: df: a6: 48.

Are you sure you want to continue connecting (yes / no)? Yes #Confirm whether you continue to contact, enter yes

Warning: Permanently added ‘github.com, 192.30.252.129’ (RSA) to the list of known hosts.

Enter passphrase for key '/c/Users/xxxx_000/.ssh/id_rsa': #Generate ssh kye if the password is empty, there is no entry, if there is a password, there is this entry, and enter the password set when generating the ssh key is can.

Hi xxx! You ‘ve successfully authenticated, but GitHub does not provide shell access. #Words appear, indicating successful setting.

END

Push local projects to GitHub via SSH
Create a sample repository on github, such as: test ssh key.

Copy the ssh path of the test ssh key.

Create a project locally

1) Create a directory

$ mkdir test

$ cd test

2) Initialization

$ git init

3) Create hello.md file

$ echo "This is a test ssh key"> hello.md

4) Submit to local

If the warning prompt above appears, resubmit it once.

$ git add. #Submit all files in the current directory

$ git commit -m "add hello.md" #Commit record description

5) Submit to github

$ git remote add origin ‘Paste and copy the ssh path of the test ssh key’ #

$ git push -u origin master

Enter passphrase for key ‘/c/Users/hgpin_000/.ssh/id_rsa’: #ssh key set the password so you need to enter the password

Refresh the test ssh key warehouse and view hello.md. (Finish)

Step reading

END

Precautions
Experience applies to win7, win8.1, win10.

Configure SSH connection to GitHub under window, ssh key to GitHub (transfer)

Related Article

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.