650) this.width=650; "alt=" "GitHub" image search Result "src=" http://www.aha.io/assets/integration_logos/ Github-bb449e0ffbacbcb7f9c703db85b1cf0b.png "" 491 "height=" 182 "/>
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.
GitHub supports 2 different modes of operation
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.
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.
The following tutorial configures an SSH connection under a Linux client
Prepare a Linux computer with access to the Internet first
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; border-bottom-width:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/8E/57/ Wkiol1i-q-ytn2nvaagngoc50qs441.png "width=" 719 "height=" 293 "/>
In the example, Centos7 is used.
Install git using the Yum install Git-core command
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; border-bottom-width:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/8E/57/ Wkiol1i-q-3ygsvmaahbmah-7ls014.png "width=" 725 "height=" 283 "/>
Run git--version after installation is complete
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; border-bottom-width:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/8E/57/ Wkiol1i-q-7clp7naaaro7mhmzi378.png "width=" 319 "height=" "/>
Generate an SSH certificate
Ssh-keygen-t rsa-c "[Email protected]"
The-t parameter is the type of the specified key, which is specified in RSA
-C is comment I'm writing a github account here.
There will be several interactions after executing the command
1,enter file in which to save the key (/ROOT/.SSH/ID_RSA): Here you can press ENTER directly, the system will use the default name to generate the key
The name of the private key is Id_rsa, and the public key name is Id_rsa.pub
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; border-bottom-width:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/8E/57/ Wkiol1i-q--qvkqfaaah3fqxpwu047.png "width=" 242 "height="/>
2,enter passphrase here can also directly press ENTER, default is no password. If you enter a password (you'll have to enter it again after you enter the password), the next time you connect to GitHub, you'll be asked to enter the password (do we use SSH to not enter the password?). , so direct return)
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; border-bottom-width:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/8E/57/wKioL1i-Q_CTT5m_ Aafdu1agyes913.png "width=" 641 "height=" "/>"
After entering the/ROOT/.SSH, the Id_rsa.pub file is uploaded to the local open or directly to cat id_rsa.pub
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; border-bottom-width:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/8E/59/wKiom1i-Q_ Gszrndaac2d5rtmke696.png "width=" 652 "height=" "/>"
Copy the contents of the key
Login to GitHub now (no account?) Of course, you have to register a first)
Enter account Setting–ssh and GPG keys
Select New SSH Key
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; border-bottom-width:0px; border-top-width:0px "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/8E/57/wKioL1i-Q_KD_8I Faag5zopp0uw084.png "width=" 760 "height=" 545 "/>
Just type a name (easy to identify where the SSH request came from)
In the key area, paste in the content you just copied, then click "Add SSH Key"
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; border-bottom-width:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/8E/57/wKioL1i-Q_ Oxwki-aagha7rm708558.png "width=" 771 "height=" 394 "/>
When you are finished, you will see the following options
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; border-bottom-width:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/8E/57/wKioL1i-Q_ Ptb2aiaab1quqkp-e829.png "width=" 755 "height=" 189 "/>
When you are done, go back to the Linux host to verify that SSH connection is OK
Perform
[email protected]
Are you sure you want to continue connecting (yes/no)?这里输入yes
如果出现
You‘ve successfully authenticated, but GitHub does not provide shell access. 则代表ssh连接已经成功
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; border-bottom-width:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/8E/59/wKiom1i-Q_SR7_ Tdaadjrlscmgc797.png "width=" 644 "height="/>
Back on GitHub, you can see that the sshkey you just added turns green.
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; border-bottom-width:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/8E/57/wKioL1i-Q_ Xdzugwaabg-k7qa9u248.png "width=" 634 "height="/>
Now we go back to the Linux host and try to clone a repo on GitHub.
A repo under my own account is as follows
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; border-bottom-width:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/8E/57/wKioL1i-Q_XAaYDAAAA7lWmP_ 3u133.png "width=" 618 "height="/>
I should have typed it under Linux.
git clone [email protected]:hzl790209/game-of-life
Start clone this repo on GitHub after entering the command
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; border-bottom-width:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/8E/59/ Wkiom1i-ra-zcog2aacaqgng9do809.png "width=" 642 "height=" Bayi "/>
This way Linux uses SSH to connect to GitHub already configured to complete
Connect to GitHub via SSH under Linux