ÔõÑù¸ü¸ÄGitLabÔ¶³Ì·¾¶
Ëæ×ÅÈí¼þ¿ª·¢µÄÉú³¤£¬gitÒѳÉΪ×î³£Óõİ汾¿ØÖƹ¤¾ßÖ®Ò»¡£gitlabÊÇÒ»¸öÊ¢ÐеÄgit¿ÍÕ»ÖÎÀí¹¤¾ßÖ®Ò»£¬ËüÔÊÐíÍŶÓÔÚÒ»¸öµØ·½¹²Ïí´úÂë²¢¸ú×Ù¶Ô´úÂëµÄ¸ü¸Ä¡£ÔÚijЩÇéÐÎÏ£¬Äú¿ÉÄÜÐèÒª¸ü¸ÄgitlabÔ¶³Ì·¾¶¡£±¾ÎĽ«ÏòÄúÏÈÈÝÔõÑù¸ü¸ÄgitlabÔ¶³Ì·¾¶¡£
GitLabÔ¶³Ì·¾¶ÊÇÖ¸ÓëGitLab¿ÍÕ»Ïà¹ØÁªµÄÔ¶³ÌGit½Úµã¡£Í¨³££¬GitLabÌṩÁ½ÖÖÔ¶³Ì·¾¶£º
HTTPS·¾¶£ºÒÔHTTPSÐÒéµÄÐÎʽÀ´»á¼ûGit¿â£¬ÐèÒªÊäÈëGitÓû§ÃûºÍÃÜÂë²Å»ª¾ÙÐлá¼û¡£
SSH·¾¶£ºÒÔSSHÐÒéµÄÐÎʽÀ´»á¼ûGit¿â¡£ÈôÊÇÄúʹÓõÄÊÇSSHÃÜÔ¿£¬ÔòÎÞÐèÊäÈëGitÓû§ÃûºÍÃÜÂë¡£
ÒÔÏÂÊÇÔõÑù¸ü¸ÄGitLabÔ¶³Ì·¾¶µÄ°ì·¨£º
°ì·¨1£º·¿ªÏÂÁîÐд°¿Ú»òÖÕ¶Ë
ÔÚÅÌËã»úÉÏ·¿ªÏÂÁîÐд°¿Ú»òÖնˡ£
°ì·¨2£º½øÈëÏîĿĿ¼
ʹÓá°cd¡±ÏÂÁî½øÈëÄúÒª¸ü¸ÄÔ¶³Ì·¾¶µÄÏîĿĿ¼¡£Ê¾Àý£ºÈôÊÇÄúµÄÏîĿĿ¼ÊÇ¡°/path/to/project¡±£¬ÔòÖ´ÐУº
cd /path/to/project
°ì·¨3£º¼ì²éÄ¿½ñµÄÔ¶³Ì·¾¶
ʹÓÃÒÔÏÂÏÂÁî¼ì²éÄ¿½ñµÄÔ¶³Ì·¾¶£º
git remote -v
´ËÏÂÁÏÔʾÓëÄúµÄ¿ÍÕ»Ïà¹ØÁªµÄÔ¶³ÌGit½ÚµãµÄÁÐ±í¡£
ʾÀýÊä³ö£º
origin https://gitlab.com/username/myproject.git (fetch)
origin https://gitlab.com/username/myproject.git (push)
°ì·¨4£ºÌí¼ÓеÄÔ¶³Ì·¾¶
ÒªÌí¼ÓеÄÔ¶³Ì·¾¶£¬ÐèʹÓá°git remote set-url¡±ÏÂÁ²¢Ö¸¶¨Òª¸ü¸ÄµÄÔ¶³Ì½ÚµãµÄÃû³Æ£¨ÀýÈç¡°origin¡±£©ÒÔ¼°ÐµÄÔ¶³Ì·¾¶¡£Ê¾ÀýÈçÏ£º
git remote set-url origin https://gitlab.com/new-username/new-project.git
´ËÏÂÁ¸üÐÂÃû³ÆΪ¡°origin¡±µÄÔ¶³Ì½Úµã£¬ÆäURL½«¸ü¸ÄΪhttps://gitlab.com/new-username/new-project.git¡£
°ì·¨5£ºÑé֤еÄÔ¶³Ì·¾¶
ʹÓá°git remote -v¡±ÏÂÁîÑéÖ¤ÄúÊÇ·ñÀֳɸü¸ÄÁËGitLabÔ¶³Ì·¾¶¡£´ËÏÂÁÏÔʾ¸ü¸ÄºóµÄÔ¶³Ì·¾¶ÁÐ±í¡£Ê¾ÀýÊä³ö£º
origin https://gitlab.com/new-username/new-project.git (fetch)
origin https://gitlab.com/new-username/new-project.git (push)
ÈôÊÇÏÔʾµÄÔ¶³Ì·¾¶ÓëÄúµÄз¾¶Æ¥Å䣬ÔòÌåÏÖ¸ü¸ÄÀֳɡ£
×ܽá
±¾ÎÄÏòÄúÏÈÈÝÁËÔõÑù¸ü¸ÄGitLabÔ¶³Ì·¾¶¡£Òª¸ü¸ÄÔ¶³Ì·¾¶£¬Çë·¿ªÏÂÁîÐд°¿Ú»òÖնˣ¬½øÈëÒª¸ü¸ÄÔ¶³Ì·¾¶µÄÏîĿĿ¼£¬²¢Ö´ÐÐgit remote set-urlÏÂÁî¡£×îºó£¬¼ì²éÄúµÄ¸ü¸ÄÊÇ·ñÀֳɡ£ÈôÊÇÄúÕýÔÚʹÓÃGitLab£¬´ËÀú³Ì¿ÉÄÜ»áºÜÊÇÓÐÓã¬ÓÉÓÚËüÔÊÐíÄú¸ü¸ÄGitLab¿ÍÕ»µÄURLÒÔ˳Ӧ²î±ðµÄÐèÒª¡£
ÒÔÉϾÍÊÇÔõÑù¸ü¸ÄGitLabÔ¶³Ì·¾¶µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡