Ïê½âUbuntuϵͳÖÐ×°ÖÃGithubµÄÒªÁì
ÔÚÒ»Ñùƽ³£ÉúÑÄÖУ¬ÅÌËã»úÒѾ³ÉΪÁËÎÒÃDZز»¿ÉÉٵŤ¾ß£¬¶ø²Ù×÷ϵͳÔòÊÇÅÌËã»ú±Ø²»¿ÉÉÙµÄÖ§³Ö¡£×÷ΪһÖÖ×ÔÓɵIJÙ×÷ϵͳ£¬ubuntuΪÓû§ÌṩÁËÒ»¸öºÜÊÇÎȹ̺Ϳɿ¿µÄÔËÐÐÇéÐΡ£¶øgithubÔòÊÇÈ«Çò×î´óµÄ¿ª·ÅÔ´ÂëÉçÇøÖ®Ò»£¬ÔÚÕâÀÓÐÊýÒÔÍò¼ÆµÄ³ÌÐòÔ±ºÍ¿ª·¢Õß·ÖÏíËûÃǵÄÏîÄ¿ÒÔ¼°´úÂë¡£¹ØÓÚ³ÌÐòÔ±¶øÑÔ£¬ÕÆÎÕubuntuºÍgithubµÄ»ù±¾Ê¹ÓÃÊÖÒÕÊǺÜÊÇÐëÒªµÄ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚubuntuϵͳÖÐ×°ÖÃgithub¡£
Ò»¡¢×°ÖÃGit
GithubÐèÒªGitµÄÖ§³Ö£¬Òò´Ë£¬Ê×ÏÈÎÒÃÇÐèÒªÔÚUbuntuϵͳÖÐ×°ÖÃGit¡£Í¨¹ýÖն˷¿ªUbuntuϵͳ£¬ÊäÈëÒÔÏÂÏÂÁ
sudo apt-get update
µÇ¼ºó¸´ÖÆ
¸ÃÏÂÁîµÄ×÷ÓÃÊǸüÐÂϵͳµÄÈí¼þ°ü¡£
½ÓÏÂÀ´£¬ÎÒÃÇÐèҪװÖÃGit£¬ÊäÈëÒÔÏÂÏÂÁ
sudo apt-get install git
µÇ¼ºó¸´ÖÆ
ϵͳ½«×Ô¶¯¼ì²é²¢ÏÂÔØGitÈí¼þ°ü¡£ÔÚ×°ÖÃÀú³ÌÖУ¬ÏµÍ³»áÌáÐÑÓû§È·ÈÏÊÇ·ñ¼ÌÐø£¬È·ÈϺ󼴿É×îÏÈ×°Öá£ÈôÊÇ×°ÖÃÀֳɣ¬Äú½«»á¿´µ½ÈçÏÂÐÅÏ¢£º
...... Setting up git (version) ... ......
µÇ¼ºó¸´ÖÆ
¶þ¡¢ÉèÖÃGithub
ÔÚ×°ÖÃGitÖ®ºó£¬ÎÒÃÇÐèÒª¶ÔGithub¾ÙÐÐÉèÖá£Í¨¹ý·¿ªÖնˣ¬ÊäÈëÒÔÏÂÏÂÁ
git config --global user.name "Your Name" git config --global user.email "email@example.com"
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬¡°Your Name¡±ºÍ¡°email@example.com¡±ÐèÒªÌæ»»³ÉÓû§µÄÕæʵÐÕÃûºÍÓÊÏäµØµã¡£Í¨¹ýÕâЩÉèÖã¬ÎÒÃÇ¿ÉÒÔ±êʶÎÒÃÇÊÇË£¬ÔÚGithubÉÏÌá½»½ÓÂëʱ¾ÍÄÜÓë×ðÁú¿Ê±GithubÕË»§¹ØÁª¡£
Èý¡¢ÌìÉúSSH Key
GithubʹÓÃSSHÃÜÔ¿¾ÙÐÐÉí·ÝÑéÖ¤À´°ü¹ÜÇå¾²¡£Òò´Ë£¬ÎÒÃÇÐèÒªÔÚUbuntuϵͳÖÐÌìÉúSSH Key£¬²¢½«ÆäÌí¼Óµ½GithubÕË»§ÉÏ¡£Í¨¹ý·¿ªÖնˣ¬ÊäÈëÒÔÏÂÏÂÁ
ssh-keygen -t rsa -C "email@example.com"
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬¡°email@example.com¡±ÐèÒªÌæ»»³ÉÓû§µÄÕæʵÓÊÏäµØµã¡£Ö´ÐиÃÏÂÁîʱ£¬ÏµÍ³½«ÌáÐÑÓû§ÊäÈëÃÜÔ¿µÄÃû³ÆºÍÃÜÂ룬ÈôÊDz»ÐèÒªÃÜÂ룬ֱ½Ó°´Enter¼ü¼´¿É¡£Ö´ÐÐÀֳɺó£¬Äú½«¿´µ½ÈçÏÂÐÅÏ¢£º
Generating public/private rsa key pair. Enter file in which to save the key (/home/you/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/you/.ssh/id_rsa. Your public key has been saved in /home/you/.ssh/id_rsa.pub.
µÇ¼ºó¸´ÖÆ
ͨ¹ýÊäÈëÒÔÏÂÏÂÁ¿ÉÒÔÉó²éSSH KeyµÄÄÚÈÝ£º
cat ~/.ssh/id_rsa.pub
µÇ¼ºó¸´ÖÆ
ËÄ¡¢Ìí¼ÓSSH Key
·¿ªGithubÖ÷Ò³£¬µã»÷Í·Ïñ£¬Ñ¡Ôñ¡°Settings¡±Ñ¡Ï¡£ÔÚÒ³ÃæÖÐÑ¡Ôñ¡°SSH and GPG keys¡±Ñ¡Ïµã»÷¡°New SSH key¡±°´Å¥£¬ÊäÈëÎÊÌâºÍSSH Key£¬µã»÷¡°Add SSH key¡±¡£
Îå¡¢ÑéÖ¤Github
ÔÚÍê³ÉÇ°ÃæµÄ°ì·¨ºó£¬ÎÒÃÇ¿ÉÒÔͨ¹ýGithub¼ì²éÅþÁ¬ÊÇ·ñÀֳɡ£·¿ªÖնˣ¬ÊäÈëÒÔÏÂÏÂÁ
ssh -T git@github.com
µÇ¼ºó¸´ÖÆ
ÈôÊÇÅþÁ¬Àֳɣ¬Äú½«»á¿´µ½ÈçÏÂÐÂÎÅ£º
Hi username! You've successfully authenticated, but Github does not provide shell access.
µÇ¼ºó¸´ÖÆ
ÖÁ´Ë£¬ÎÒÃÇÒѾÀÖ³ÉÔÚUbuntuϵͳÖÐ×°ÖÃÁËGithub¡£ÔÚÒÔºóµÄ¿ª·¢Àú³ÌÖУ¬ÎÒÃÇ¿ÉÒÔ½«´úÂëÉÏ´«µ½GithubÖУ¬Àû±ãËûÈËÉó²éºÍŲÓá£
ÒÔÉϾÍÊÇÏê½âUbuntuϵͳÖÐ×°ÖÃGithubµÄÒªÁìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡