ÔõÑùʹÓÃGit¾ÙÐÐpush²Ù×÷
ÔÚÈí¼þ¿ª·¢Àú³ÌÖУ¬°æ±¾ÖÎÀíÊÇÒ»ÏîÖ÷ÒªµÄÊÂÇé¡£git×÷Ϊ×î³£Óõİ汾ÖÎÀí¹¤¾ßÖ®Ò»£¬¿ÉÒÔ×ÊÖúÍŶÓÐ×÷Ô½·¢¸ßЧ¡£ÔÚgitÖУ¬push²Ù×÷¼´Êǽ«ÍâµØ´úÂëÍÆËÍÖÁÔ¶³Ì¿ÍÕ»£¬±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃgit¾ÙÐÐpush²Ù×÷¡£
¿ªÆôSSHÈÏÖ¤
ÈôÒÑÍê³É¿½±´Ô¶³Ì¿ÍÕ»²Ù×÷£¬ÔòÐèÒªÏÈÐпªÆôSSHÈÏÖ¤¡£·¿ªÖնˣ¨MacOS/Linux£©»òGit Bash£¨Windows£©£¬ÊäÈëÒÔÏÂÏÂÁ
ssh-keygen -t rsa -C "your_email@example.com"
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬¡°your_email@example.com¡±ÐèÌ滻Ϊע²áGitHub/GitLabʹÓõÄÓÊÏäµØµã¡£°´Ï»سµ£¬´Ëʱ½«½¨É蹫/˽Կ¶Ô£º
Generating public/private rsa key pair. Enter file in which to save the key (/Users/you/.ssh/id_rsa):
µÇ¼ºó¸´ÖÆ
ƾ֤ÌáÐÑÒ»²½²½Íê³ÉÉèÖã¬Íê³Éºó£¬Ê¹ÓÃÒÔÏÂÏÂÁîÀ´ÈÃSSHÑéÖ¤Ìí¼Óµ½AgentÖУº
eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa
µÇ¼ºó¸´ÖÆ
Ìí¼ÓÔ¶³Ì¿ÍÕ»
ÔÚÍâµØ´úÂë¿ÍÕ»ÏÂÔËÐÐÏÂÁ
git remote add origin git@xxxxxx.git
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬originÊÇÔ¶³Ì¿âÃû£¬ÒÀ¾Ýϲ»¶¿É×ÔÓɸü¸Ä£¬git@xxxxxx.gitÔòΪSSHÃûÌõÄÔ¶³Ì¿ÍÕ»µØµã£¬Ó¦Ì滻ΪÏÖʵµÄµØµã¡£
¼ì²éÍâµØ¿ÍÕ»
ÔÚͬ²½µ½Ô¶³Ì¿Íջǰ£¬ÐèÈ·±£ÍâµØ´úÂë¿ÍÕ»´¦ÓÚ׼ȷµÄ·ÖÖ§¡£¿ÉÒÔʹÓÃÈçÏÂÏÂÁîÉó²éÄ¿½ñËù´¦·ÖÖ§£º
git branch
µÇ¼ºó¸´ÖÆ
¸ÃÏÂÁîÊä³öÖУ¬Ç°Ãæ´øÓÐ*µÄ·ÖÖ§¼´ÎªÄ¿½ñËùÔÚ·ÖÖ§¡£
Ìá½»½ÓÂë
Íê³É´úÂëÐ޸ĺó£¬ÔËÐÐÈçÏÂÏÂÁ¸ü¸ÄÄÚÈÝÔÝ´æÖÁÍâµØ¿ÍÕ»£º
git add .
µÇ¼ºó¸´ÖÆ
ÆäÖÐ.ÌåÏÖÄ¿½ñÎļþ¼ÐϵÄËùÓÐÎļþ¡£ÈôÒªÖ»ÌύijЩÎļþµÄ¸ü¸Ä£¬Ôò¿É½«.Ìæ»»³ÉÎļþÃû¡£
Ìá½»¸ü¸ÄÄÚÈÝ£º
git commit -m "commit message"
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬commit messageÓ¦ÌîдÓÐÒâÒåµÄ̸ÂÛ£¬ÒÔÀû±ãºóÐøÖÎÀí¡£ÀýÈ磬¡°ÐÞ¸ÄÁËXX¹¦Ð§¡±µÈ¡£
ÍÆË͵½Ô¶³Ì¿ÍÕ»
ÓÉÓÚ¿ªÆôÁËSSHÈÏÖ¤£¬¹Êͨ¹ýÒÔÏÂÏÂÁÍâµØ´úÂëÍÆËÍÖÁÔ¶³Ì¿ÍÕ»£º
git push origin branch_name
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬branch_nameÓ¦ÌîдÐèÒªpushµÄ·ÖÖ§Ãû£¬Ò»Ñùƽ³£Îªmaster¡£
Íê³ÉÉÏÊö°ì·¨ºó£¬´úÂë¼´±»Ìá½»ÖÁÔ¶³Ì¿ÍÕ»¡£
Óöµ½ÍÆËÍʧ°Ü
ÈôÊÇÍÆËÍÀú³ÌÖÐÓöµ½Ê§°ÜµÄÇéÐΣ¬¿ÉÒÔͨ¹ýÈçÏÂÏÂÁîÏÈpullÔ¶³Ì¿ÍÕ»µÄ×îа汾£¬ÔÙ¾ÙÐÐpush²Ù×÷£º
git pull origin branch_name
µÇ¼ºó¸´ÖÆ
ÈôÐÞ¸ÄÓгåÍ»£¬»áÌáÐÑÐèÒªÊÖ¶¯½â¾ö³åÍ»¡£ÊÖ¶¯½â¾öºó£¬ÔÙ´ÎÌá½»¼´¿É¡£
ÒÔÉϼ´ÎªGit¾ÙÐÐpush²Ù×÷µÄÏêϸÁ÷³Ì£¬Ï£Íû¶ÁÕßÃÇÄܹ»ÕÆÎÕ²¢ÊìÁ·Ó¦Óá£
ÒÔÉϾÍÊÇÔõÑùʹÓÃGit¾ÙÐÐpush²Ù×÷µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡