gitlabÔõÑùÄÜÉÁ¿ª·¢Õßpush
gitlabÊÇÒ»¸ö¿ªÔ´°æ±¾¿ØÖÆϵͳ£¬¿É×ÊÖú¿ª·¢ÕßÐ×÷±àдÈí¼þ¡£ÒªÊ¹¿ª·¢ÕßÄܹ»push£¬ÐèÒªÍê³ÉÒÔÏ°취¡£
°ì·¨1£º½¨ÉèÒ»¸öGitLabÕË»§
ÔÚGitLab×¢ÊéÒ³ÃæÉϽ¨ÉèÕË»§£¬ÌîдÄúµÄÐÕÃû£¬ÓÊÏäºÍÃÜÂë¡£µã»÷×¢²á°´Å¥Íê³É×¢²á¡£×¢²áÍê³Éºó£¬Äú¿ÉÒÔÑ¡Ôñ½¨ÉèÒ»¸öÐÂÏîÄ¿»ò¼ÓÈëÒÑÓеÄÏîÄ¿Ð×÷¿ª·¢¡£
°ì·¨2£º½¨ÉèÒ»¸öÐÂÏîÄ¿
ÔÚGitLabÕË»§ÖУ¬µã»÷¡°New project¡±°´Å¥£¬ÊäÈëÃû³Æ£¬ÐÎòºÍÑ¡Ôñ¿É¼ûÐÔ¿ØÖÆÉèÖã¬È»ºóµã»÷¡°Create project¡±°´Å¥¡£½¨ÉèÍê³Éºó£¬Äú¿ÉÒÔͨ¹ý»á¼ûÏîÄ¿Ö÷Ò³À´ÖÎÀíÏîÄ¿¡£ÔÚÖ÷Ò³ÉÏ£¬¿ÉÒÔ¿´µ½´úÂë¡¢ÎÊÌâ¡¢ºÏ²¢ÇëÇóºÍ¹¹½¨µÈÐÅÏ¢¡£
°ì·¨3£ºÉèÖÃSSHÃÜÔ¿
Òª½«ÍâµØµÄGit¿ÍÕ»ÓëGitLabЧÀÍÆ÷ͬ²½£¬ÔÚµÚÒ»´ÎʹÓÃSSHÐÒé¾ÙÐÐͨѶʱ£¬ÐèÒª¾ÙÐÐÉí·ÝÑéÖ¤¡£Ê¹ÓÃSSHÃÜÔ¿¶ÔË«·½¾ÙÐÐÉí·ÝÑéÖ¤¡£Îª´Ë£¬ÐèÒªÔÚСÎÒ˽ÈËÉèÖÃÒ³ÃæÉÏÊäÈëSSHÃÜÔ¿¡£ÒªÔÚÍâµØÉÏÌìÉúSSHÃÜÔ¿£¬Çë·¿ª¿ØÖÆ̨²¢ÊäÈëÒÔÏÂÏÂÁ
$ ssh-keygen -t rsa -C “your_email@example.com”
ÏÂÁîÖ´Ðкó£¬Æ¾Ö¤ÌáÐÑÊäÈëÃÜÔ¿Ãû³ÆºÍÃÜÂë¡£ÃÜÔ¿½«´æ´¢ÔÚ~/.ssh/id_rsa.pubÎļþÖС£
½«¹«Ô¿¸´ÖƵ½GitLabÕË»§Ð¡ÎÒ˽ÈËÉèÖÃÇøÓòÖС£Òª½«ÃÜÔ¿Ìí¼Óµ½GitLab£¬ÇëÖ´ÐÐÒÔÏ°취£º
ÔÚGitLabÖУ¬µ¥»÷Í·Ïñ£¬È»ºóÑ¡Ôñ¡°Settings>SSH Keys¡±£»
µã»÷¡°Add Key¡±°´Å¥£»
ÔÚ¹«Ô¿×Ö¶ÎÖУ¬Õ³Ìù֮ǰ¸´ÖƵĹ«Ô¿ÄÚÈÝ£»
µã»÷¡°Add Key¡±°´Å¥¡£
°ì·¨4£ºÔÚÍâµØ¿ÍÕ»ÖÐÌí¼ÓÔ¶³Ì¿ÍÕ»
ÔÚÏòGitLab¿ÍÕ»ÉÏÍÆËÍ´úÂë֮ǰ£¬ÐèÒª½«ÍâµØ¿ÍÕ»ÓëGitLab¿ÍÕ»¾ÙÐÐÅþÁ¬¡£¿ÉÒÔͨ¹ýÒÔÏ·½·¨½«Git¿ÍÕ»ÓëGitLabЧÀÍÆ÷ͬ²½£º
·¿ª¿ØÖÆ̨²¢µ¼º½µ½Ä¿µÄ¿ÍÕ»µÄĿ¼£»
ÊäÈëÒÔÏÂÏÂÁԶ³Ì¿ÍÕ»Ìí¼Óµ½ÍâµØ¿ÍÕ»ÖУº
$ git remote add origin git@gitlab.com:user/repo.git
Ç뽫¡°user/repo.git¡±Ì滻ΪÄúµÄGitLab¿ÍÕ»Á´½Ó¡£
°ì·¨5£ºÍÆËÍ´úÂë
Òª½«´úÂëÍÆË͵½GitLabЧÀÍÆ÷ÉÏ£¬ÇëÖ´ÐÐÒÔÏ°취£º
ÔÚÍâµØ´úÂëÖоÙÐиü¸Ä£»
½«¸ü¸ÄÌí¼Óµ½GitË÷ÒýÖУº
$ git add .
Ìá½»ËùÓиü¸Ä£º
$ git commit -m “Commit message”
½«¸ü¸ÄÍÆË͵½GitLabЧÀÍÆ÷£º
$ git push origin master
Íê³ÉÍÆËͺ󣬴úÂë¾Í»á·ºÆðÔÚGitLabµÄ´úÂë¿âÖС£ÆäËûÐ×÷Õß¿ÉÒÔͨ¹ýÀÈ¡ÏÂÁîÀ´Í¬²½²¢¼ÓÈ뿪·¢¡£
×ܽá
ÍÆËÍ´úÂëµ½GitLabÊÇÒ»¸ö±Ø±¸µÄÊÖÒÕ£¬¹ØÓÚ¿ª·¢ÕßÀ´ËµºÜÊÇÖ÷Òª¡£Í¨¹ý¶ÔÉÏÊö°ì·¨µÄʵ¼ù£¬¿ÉÒÔÀû±ã¿ì½ÝµØÍÆËÍÄúµÄ´úÂ룬²¢Ê¹ÄúµÄÏîÄ¿»ñµÃ¸üºÃµÄÐ×÷ºÍ¿ª·¢¡£Í¬ÑùÔÚÍÆËÍʱ£¬ÐèҪעÖØÎĵµµÄ°æ±¾¸üС¢Ã÷ȷʹÃüÄ¿µÄ£¬ÕâЩ¶¼ÊÇЧ¹ûµÄ°ü¹Ü¡£
ÒÔÉϾÍÊÇgitlabÔõÑùÄÜÉÁ¿ª·¢ÕßpushµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡