½â˵ÔõÑùÔÚGitÉÏÉèÖÃSSH Key
gitÊÇÏÖÔÚÌìÏÂÉÏ×îÊ¢ÐеÄÓÉlinus torvalds½¨ÉèµÄ°æ±¾¿ØÖÆÈí¼þÖ®Ò»¡£ÔÚ¿ª·¢Àú³ÌÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃgit¶Ô´úÂë¾ÙÐа汾¿ØÖÆ¡¢Ð×÷¿ª·¢µÈ¡£ÔÚʹÓÃgitʱ£¬ÎÒÃÇ¿ÉÒÔʹÓÃssh key¾ÙÐÐÉí·ÝÑéÖ¤£¬ÒÔ±ãÓÚÎÒÃǵĴúÂë¿âºÍЧÀÍÆ÷Ö®¼äµÄÇå¾²ÅþÁ¬¡£ÏÂÃ棬ÎÒÃÇÀ´Ïêϸ½â˵ÔõÑùÔÚgitÉÏÉèÖÃssh key¡£
Ò»¡¢ÌìÉúSSH Key
·¿ªÖն˻òÏÂÁîÐС£
ÊäÈë²¢Ö´ÐÐÒÔÏÂÏÂÁ
ssh-keygen -t rsa -C "your_email@example.com"
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬½« “your_email@example.com” Ì滻ΪÄãµÄÓÊÏäµØµã¡£
Ö´Ðкó»á·ºÆðÈçÏÂÌáÐÑ£º
Generating public/private rsa key pair. Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):
µÇ¼ºó¸´ÖÆ
Ö±½Ó°´»Ø³µ¼ü£¬Ê¹ÓÃĬÈÏÇéÐμ´¿É¡£½Ó×Å£¬»áÌáÐÑÊäÈëÃÜÂ룬Ҳ¿ÉÒÔÖ±½Ó»Ø³µÌø¹ý¡£
ÌìÉúÀֳɺ󣬿ÉÒÔÔÚ .ssh Ŀ¼Ï¿´µ½Á½¸öÎļþ£ºid_rsa ºÍ id_rsa.pub¡£
¶þ¡¢½«SSH KeyÌí¼Óµ½GitHubÕË»§
µÇ¼ÄãµÄGitHubÕË»§¡£
µã»÷ÓÒÉϽǵÄÍ·Ïñ£¬Ñ¡Ôñ Settings¡£
Ñ¡Ôñ SSH and GPG keys¡£
µã»÷ÓÒÉÏ½ÇµÄ New SSH key¡£
ÔÚµ¯³öµÄÌí¼ÓSSH KeyµÄ¿òÖУ¬ÊäÈëTitleºÍKey¡£
TitleÊÇΪSSH KeyÆðµÄÒ»¸öÃû³Æ£¬KeyÊÇÔÚÖÕ¶ËÖÐÌìÉúµÄSSH KeyµÄ¹«Ô¿ÄÚÈÝ£¨¼´ .ssh Ŀ¼Ï嵀 id_rsa.pub ÎļþÄÚÈÝ£©¡£
µã»÷Ìí¼Ó¡£
Èý¡¢½«SSH KeyÌí¼Óµ½GitLabÕË»§
µÇ¼ÄãµÄGitLabÕË»§¡£
µã»÷ÓÒÉϽǵÄÍ·Ïñ£¬Ñ¡Ôñ Settings¡£
Ñ¡Ôñ SSH keys¡£
µã»÷ÓÒÉÏ½ÇµÄ Add SSH key¡£
TitleÊÇΪSSH KeyÆðµÄÒ»¸öÃû³Æ£¬KeyÊÇÔÚÖÕ¶ËÖÐÌìÉúµÄSSH KeyµÄ¹«Ô¿ÄÚÈÝ£¨¼´ .ssh Ŀ¼Ï嵀 id_rsa.pub ÎļþÄÚÈÝ£©¡£
µã»÷Ìí¼Ó¡£
ËÄ¡¢½«SSH KeyÌí¼Óµ½BitbucketÕË»§
µÇ¼ÄãµÄBitbucketÕË»§¡£
µã»÷ÓÒÉϽǵÄÍ·Ïñ£¬Ñ¡Ôñ Bitbucket settings¡£
Ñ¡Ôñ SSH keys¡£
µã»÷ÓÒÉÏ½ÇµÄ Add key¡£
TitleÊÇΪSSH KeyÆðµÄÒ»¸öÃû³Æ£¬KeyÊÇÔÚÖÕ¶ËÖÐÌìÉúµÄSSH KeyµÄ¹«Ô¿ÄÚÈÝ£¨¼´ .ssh Ŀ¼Ï嵀 id_rsa.pub ÎļþÄÚÈÝ£©¡£
µã»÷Ìí¼Ó¡£
Îå¡¢²âÊÔSSH Key
ÔÚÖÕ¶ËÊäÈëÒÔÏÂÏÂÁ
ssh -T git@github.com
µÇ¼ºó¸´ÖÆ
ÒÔGitHubΪÀý£¬ÈôÊÇ·ºÆðÒÔÏÂÌáÐÑÔòÌåÏÖÀֳɣº
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
µÇ¼ºó¸´ÖÆ
ÈôÊÇÓöµ½ÅþÁ¬ÎÊÌ⣬ÔòÐèÒª½øÒ»²½¼ì²éSSH KeyµÄÉèÖᢷÀ»ðǽµÈ¡£
ÒÔÉϾÍÊǽâ˵ÔõÑùÔÚGitÉÏÉèÖÃSSH KeyµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡