ÔõÑùÔÚgithubÉϾÙÐÐpush²Ù×÷
ÔÚʹÓà git ¾ÙÐа汾¿ØÖƵÄÀú³ÌÖУ¬Ìá½»£¨commit£©ÊÇÒ»¸öºÜ³£¼ûµÄ²Ù×÷£¬¿ÉÊÇÈôÊÇÖ»ÊÇÔÚÍâµØÌá½»£¬ÄÇô±ðÈËÊÇÎÞ·¨Éó²éÄãµÄ´úÂëµÄ¡£ÎªÁËÈñðÈËÄܹ»Éó²é²¢ÇÒ¶Ô´úÂë¾ÙÐÐÐ޸ģ¬ÎÒÃÇÐèÒª½«´úÂë push µ½Ô¶³Ì¿ÍÕ»¡£github ÊÇÏÖÔÚ×îÊ¢ÐеĴúÂëÍйÜƽ̨֮һ£¬±¾ÆªÎÄÕ½«ÏÈÈÝÔõÑùÔÚ github ÉϾÙÐÐ push ²Ù×÷¡£
°ì·¨Ò»£º½¨Éè¿ÍÕ»
ÔÚ github Ö÷Ò³ÉÏÓÒÉÏ½ÇµÄ ¡°+¡± ±ê¼ÇÏÂÀ²Ëµ¥ÖÐÑ¡Ôñ ¡°New repository¡±£¬½¨ÉèÒ»¸öеĿÍÕ»£¬²¢ÔÚ¿ÍÕ»Ãû³ÆÏ·½Ñ¡ÔñÊÇ·ñÐèÒª½¨Éè README ÎļþºÍ .gitignore Îļþ¡£
°ì·¨¶þ£ºÉèÖÃÔ¶³Ì¿ÍÕ»
ÔÚÖÕ¶ËÖÐÖ´ÐÐÒÔÏÂÏÂÁ
git remote add origin Ô¶³Ì¿ÍÕ»µØµã
ÕâÀï°ÑÔ¶³Ì¿ÍÕ»µÄµØµã¼ÇΪ Ô¶³Ì¿ÍÕ»µØµã£¬ÐèÒª½«ÆäÌ滻ΪÏÖʵµÄÔ¶³Ì¿ÍÕ»µØµã¡£
ʹÓà git remote -v ÏÂÁî¿ÉÒÔÉó²éÄ¿½ñ¿ÍÕ»µÄËùÓÐÔ¶³Ì¿ÍÕ»ÐÅÏ¢£¬ÈçÏ£º
$ git remote -v origin git@github.com:username/repository.git (fetch) origin git@github.com:username/repository.git (push)
µÇ¼ºó¸´ÖÆ
ÈôÊÇÏÔʾµÄÐÅÏ¢ÓÐÎ󣬿ÉÒÔʹÓà git remote rm origin ÏÂÁîɾ³ýÄ¿½ñ¿ÍÕ»µÄÔ¶³Ì¿ÍÕ»ÐÅÏ¢£¬È»ºóÖØоÙÐÐÉèÖá£
°ì·¨Èý£ºÌí¼Ó²¢Ìá½»½ÓÂë
ÔÚÍâµØ¿ÍÕ»ÖÐÌí¼Ó´ýÌá½»µÄ´úÂëÎļþ£¨»òÎļþ¼Ð£©£º
git add filename »òÕß git add foldername
ÆäÖУ¬filename ºÍ foldername »®·ÖÖ¸´ú´ýÌá½»µÄµ¥¸öÎļþºÍÎļþ¼Ð¡£
Ö´ÐÐÍêÌí¼Ó²Ù×÷ºó£¬Ê¹Óà git status ÏÂÁî¿ÉÒÔÉó²éÄ¿½ñÍâµØ¿ÍÕ»µÄ״̬£¬ÈçÏ£º
$ git status On branch master No commits yet Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: filename</file>
µÇ¼ºó¸´ÖÆ
È»ºóÖ´ÐÐÌá½»²Ù×÷£º
git commit -m”commit message”
commit message Ö¸´úÌá½»µÄÐÅÏ¢£¬¿ÉÒÔƾ֤ÏÖÕæÏàÐθü¸Ä¡£
°ì·¨ËÄ£ºÍÆËÍ´úÂë
ÔÚÍâµØ¿ÍÕ»ÖÐÌá½»Íê´úÂëºó£¬Ö´ÐÐÒÔÏÂÏÂÁ´úÂëÍÆË͵½Ô¶³Ì¿ÍÕ»£º
git push -u origin master
ÕâÀ¡°-u¡±²ÎÊýÖ¸´ú¡°–set-upstream¡±£¬ÓÃÓÚ¹ØÁªÍâµØ¿ÍÕ»µÄÖ÷·ÖÖ§£¨branch£©ÓëÔ¶³Ì¿ÍÕ»µÄÖ÷·ÖÖ§£¬²¢ÇÒµÚÒ»´ÎÍÆËÍÐèҪʹÓøòÎÊý¡£
ÈôÊDz»ÐèÒª¹ØÁªÖ÷·ÖÖ§£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
git push origin ·ÖÖ§Ãû
ÕâÀ·ÖÖ§Ãû Ö¸´úÐèÒªÍÆË͵ķÖÖ§Ãû³Æ¡£ÆäÖУ¬¡°origin¡± ÊÇÖ¸Ô¶³Ì¿ÍÕ»µÄÃû³Æ£¬ÐèҪƾ֤ÏÖÕæÏàÐξÙÐиü¸Ä¡£
Ö´ÐÐÍêÍÆËͲÙ×÷ºó£¬¿ÉÒÔÔÚÔ¶³Ì¿ÍÕ»ÖÐÉó²éµ½ÍâµØ¿ÍÕ»ÖеĴúÂëÎļþ£¨»òÎļþ¼Ð£©¡£
×ܽá
ÒÔÉϾÍÊÇÔÚ github ÉϾÙÐÐ push ²Ù×÷µÄËùÓÐÁ÷³Ì¼°°ì·¨¡£×ܽáһϣº
½¨Éè github ¿ÍÕ»
ÉèÖÿÍÕ»µÄÔ¶³Ì¿ÍÕ»µØµã
ÔÚÍâµØ¿ÍÕ»ÖÐÌí¼Ó²¢Ìá½»½ÓÂë
Ö´ÐÐÍÆËͲÙ×÷£¬½«´úÂëÍÆË͵½Ô¶³Ì¿ÍÕ»
¹ØÓÚ³õѧÕßÀ´Ëµ£¬ÕÆÎÕ git »ù±¾²Ù×÷ÊDZز»¿ÉÉٵģ¬Ëü²»µ«Äܹ»×ÊÖúÎÒÃǸüºÃµØÖÎÀí´úÂ룬»¹Äܹ»Ôö½øÐ×÷ºÍÍŶÓÏàÖú¡£Ï£ÍûÕâƪÎÄÕÂÄܹ»×ÊÖúÄã¸üºÃµØʹÓà github ƽ̨¡£
ÒÔÉϾÍÊÇÔõÑùÔÚgithubÉϾÙÐÐpush²Ù×÷µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡