Ïê½âGitÕ˺ÅÃÜÂëµÄÉèÖÃÒªÁì
ÔÚʹÓà git ¾ÙÐдúÂëÖÎÀíʱ£¬ÎªÁË°ü¹ÜÕ˺ÅÇå¾²£¬ÎÒÃÇÐèÒª¶Ô git Õ˺ÅÃÜÂë¾ÙÐÐÉèÖá£ÏÂÃ棬ÎÒÃǽ«ÏêϸÏÈÈÝ git Õ˺ÅÃÜÂëÉèÖõÄÒªÁì¡£
Ò»¡¢Git Õ˺ÅÃÜÂëÉèÖÃÌõ¼þÌõ¼þ
ÔÚ¾ÙÐÐ Git Õ˺ÅÃÜÂëÉèÖÃÇ°£¬ÐèÒªÏÈÖª×ãÒÔÏÂÌõ¼þ£º
1.ÓµÓÐ Git Õ˺Å
2.ÒÑ×°Öúà Git
¶þ¡¢Git Õ˺ÅÃÜÂëÉèÖÃÒªÁì
Git Õ˺ÅÃÜÂëµÄÉèÖ÷ÖΪÒÔÏÂÁ½ÖÖÇéÐΣº
1.ÏÂÁîÐÐÉèÖÃ
2.¿ÉÊÓ»¯¹¤¾ßÉèÖÃ
ÒÔÏÂÊÇÏêϸ°ì·¨£º
ÏÂÁîÐÐÉèÖÃ
£¨1£©ÉèÖÃÓû§ÃûºÍÓÊÏä
$ git config –global user.name “Your Name”
$ git config –global user.email “your_email@example.com”
×¢Öؽ« “Your Name” ¸ÄΪÄãµÄÐÕÃû£¬”your_email@example.com” ¸ÄΪÄãµÄÓÊÏäµØµã¡£
£¨2£©½¨ÉèÔ¶³Ì¿ÍÕ»
Ê×ÏÈ£¬ÔÚ Git ЧÀÍÆ÷ÉϽ¨ÉèÒ»¸öÔ¶³Ì¿ÍÕ»¡£
£¨3£©ÍâµØ¿ÍÕ»¹ØÁªÔ¶³Ì¿ÍÕ»
ÔÚÍâµØ¿ÍÕ»ËùÔÚĿ¼Ï£¬Ö´ÐÐÒÔÏÂÏÂÁ
git remote add origin git@github.com:yourname/yourrepository.git
ÆäÖУ¬yourname ÊÇÄãµÄ GitHub Óû§Ãû£¬yourrepository ÊÇÄãµÄÔ¶³Ì¿ÍÕ»Ãû¡£
£¨4£©ÉèÖà SSH key
ÔÚ Git Bash ÖÐÖ´ÐÐÒÔÏÂÏÂÁ
ssh-keygen -t rsa -C “your_email@example.com”
ƾ֤ÌáÐÑÒ»²½²½¾ÙÐУ¬½«ÌìÉúµÄ SSH key Ìí¼Óµ½ Git Õ˺ÅÖС£
£¨5£©ÉúÑÄÕ˺ÅÃÜÂë
ÔÚ Git Bash ÖÐÖ´ÐÐÒÔÏÂÏÂÁ
git config –global credential.helper store
´Ë²Ù×÷»á½«ÃÜÂëÉúÑÄÔÚÄãµÄÍâµØÓ²ÅÌÉÏ¡£
¿ÉÊÓ»¯¹¤¾ßÉèÖÃ
ÈôÊÇÄãÕýÔÚʹÓà Git ¿ÉÊÓ»¯¹¤¾ß£¬ÄÇôÄã¿ÉÒÔͨ¹ý¹¤¾ßµÄ½çÃæ¾ÙÐÐÕ˺ÅÃÜÂëµÄÉèÖᣳ£¼ûµÄ Git ¿ÉÊÓ»¯¹¤¾ßÓÐ GitKraken¡¢SourceTree¡¢Git GUI µÈ¡£
Èý¡¢Git Õ˺ÅÃÜÂëÉèÖõÄ×¢ÖØÊÂÏî
ΪÁËÕ˺ÅÇå¾²£¬½¨ÒéʹÓà SSH ÐÒé¾ÙÐÐÅþÁ¬ºÍÌá½»½ÓÂëµÄ²Ù×÷¡£Í¬Ê±£¬Ò²¿ÉÒÔ°´ÆÚ¸üÐÂÕ˺ÅÃÜÂëºÍ SSH key¡£
ÈôÊÇÄãÏ£ÍûÃÜÂë²»ÉúÑÄÔÚÍâµØÓ²ÅÌÉÏ£¬¿ÉÒÔÉèÖûº´æʱ¼ä£¬ÀýÈ磺
git config –global credential.helper ‘cache –timeout=3600’
´Ë²Ù×÷½«»º´æÃÜÂë 3600 Ã룬Ҳ¿ÉÒÔͨ¹ýÔÚÏÂÁîÖмÓÈë –timeout ²ÎÊýÀ´Ö¸¶¨»º´æʱ¼ä¡£
ÈôÊÇÄãÓжà¸ö Git Õ˺ţ¬¿ÉÒÔͨ¹ýÉèÖòî±ðµÄÍâµØ SSH key À´Çø·Ö²î±ðµÄÕ˺š£ÔÚ¾ÙÐдúÂëÌύʱ£¬Æ¾Ö¤²î±ðµÄÕ˺ÅÖ¸¶¨²î±ðµÄ SSH key¡£
×ÜÖ®£¬Git Õ˺ÅÃÜÂëµÄÉèÖúÜÊÇÖ÷Òª£¬ÐèÒªÍ×ÉÆÖÎÀíºÍ±£»¤ºÃ×Ô¼ºµÄÕ˺ÅÐÅÏ¢£¬²Å»ª¸üºÃµØ°ü¹Ü´úÂëµÄÇå¾²ÎÂ˳ËìµØ¾ÙÐдúÂëÖÎÀí¡£
ÒÔÉϾÍÊÇÏê½âGitÕ˺ÅÃÜÂëµÄÉèÖÃÒªÁìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡