gitÔõôÐÞ¸ÄoriginµØµã£¿Ê¾ÀýÏê½â
ÔÚʹÓà git ¾ÙÐÐÐ×÷¿ª·¢µÄÀú³ÌÖУ¬ÎÒÃǾ³£ÐèÒªÐÞ¸ÄÔ¶³Ì¿ÍÕ»µÄµØµã¡£¹ØÓÚ git ¶øÑÔ£¬Ã¿Ò»¸öÔ¶³Ì¿ÍÕ»¶¼ÊÇÒ»¸ö git ЧÀÍÆ÷µÄµØµã£¬Õâ¸öµØµã±»³ÆΪ origin¡£Ò»Ñùƽ³£ÇéÐÎÏ£¬ÎÒÃÇÐèÒªÐÞ¸Ä origin µÄµØµãÀ´ÅþÁ¬²î±ðµÄ git ЧÀÍÆ÷»òÕß²î±ðµÄ·ÖÖ§¡£±¾ÎĽ«ÏÈÈÝÔõÑùÐÞ¸Ä git µÄ origin µØµã¡£
Ò»¡¢Éó²éÄ¿½ñµÄ origin
ÔÚ Git ÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÀ´Éó²éÄ¿½ñ origin µÄµØµã£º
git remote -v
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
ÔËÐиÃÏÂÁîºó£¬»áÊä³ö Git Ô¶³Ì¿ÍÕ»µÄµØµãÁÐ±í£¬Õâ¸öÁбí»áÏÔʾÿ¸öÔ¶³Ì¿ÍÕ»µÄÃû³ÆºÍµØµã£º
origin https://github.com/username/repo.git (fetch) origin https://github.com/username/repo.git (push)
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
ÔÚ¸ÃÁбíÖУ¬origin ÊÇ Git ĬÈϵÄÔ¶³Ì¿ÍÕ»Ãû³Æ£¬ºóÃæµÄµØµãÔòÊǸÿÍÕ»µÄ HTTPS URL¡£ÈôÊÇÄãÊÇʹÓà SSH ÅþÁ¬ Git ЧÀÍÆ÷£¬ÄÇôÊä³öµÄ½«ÊÇ SSH URL¡£
¶þ¡¢ÐÞ¸Ä origin
ÈôÊÇÎÒÃÇÐèÒªÐÞ¸Ä origin µÄµØµã£¬¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÀ´ÊµÏÖ£º
git remote set-url origin <new-url></new-url>
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬ ΪÐ嵀 Git ЧÀÍÆ÷µØµã¡£Í¨¹ý¸ÃÏÂÁGit ½«»áÐÞ¸Ä origin µÄµØµã£¬´Ó¶øÅþÁ¬µ½ÐµÄÔ¶³Ì¿ÍÕ»¡£
Èý¡¢Ê¾Àý
ΪÁËÈø÷È˸üºÃµØÃ÷È·ÐÞ¸Ä origin µÄÀú³Ì£¬ÏÂÃ潫¾ÙÒ»¸öÏÖʵµÄʾÀý¡£
¼ÙÉèÎÒÃÇÒª½«Ä¿½ñµÄÔ¶³Ì¿ÍÕ»ÅþÁ¬µ½ÁíÍâÒ»¸ö Git ЧÀÍÆ÷ÉÏ¡£Ê×ÏÈ£¬ÎÒÃÇÐèÒªÉó²éÄ¿½ñ origin µÄµØµã£º
git remote -v
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
Êä³ö£º
origin https://github.com/username/repo.git (fetch) origin https://github.com/username/repo.git (push)
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
½ÓÏÂÀ´£¬Í¨¹ýÒÔÏÂÏÂÁԶ³Ì¿ÍÕ»ÅþÁ¬µ½Ð嵀 Git ЧÀÍÆ÷£º
git remote set-url origin https://gitlab.com/username/repo.git
µÇ¼ºó¸´ÖÆ
ÔËÐиÃÏÂÁîºó£¬Git ±ã»á½« origin µÄµØµãÐÞ¸ÄΪ https://gitlab.com/username/repo.git¡£ÈôÊÇÏëҪȷÈÏ origin ÊÇ·ñÒѾ±»ÐÞ¸ÄÀֳɣ¬¿ÉÒÔÖØÐÂÔËÐÐ git remote -v ÏÂÁÊä³öÓ¦¸ÃΪ£º
origin https://gitlab.com/username/repo.git (fetch) origin https://gitlab.com/username/repo.git (push)
µÇ¼ºó¸´ÖÆ
ËÄ¡¢½áÂÛ
ÐÞ¸Ä Git µÄ origin µØµãÊǾ³£ÐèÒª¾ÙÐеIJÙ×÷Ö®Ò»£¬ÓÈÆäÊÇÔÚ¶àÈËÐ×÷¿ª·¢Ê±¡£Í¨¹ý±¾ÎÄËùÏÈÈݵÄÒªÁ죬ÎÒÃÇ¿ÉÒÔÀû±ãµØÐÞ¸Ä origin µÄµØµã£¬´Ó¶øÅþÁ¬µ½²î±ðµÄ Git ЧÀÍÆ÷»òÕß²î±ðµÄ·ÖÖ§¡£
ÒÔÉϾÍÊÇgitÔõôÐÞ¸ÄoriginµØµã£¿Ê¾ÀýÏê½âµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡