×ðÁú¿­Ê±

Ïê½âmacÉÏÔõô´î½¨GitHubÇéÐÎ

Ëæ×ÅÊÖÒÕµÄÆÕ¼°ºÍ¿ªÔ´µÄʱ´úÀ´ÁÙ £¬¸ü¶àµÄÈË×îÏȹØ×¢github¡£×÷ΪȫÇò×î´óµÄ¿ªÔ´ÉçÇøºÍ°æ±¾¿ØÖÆÖÎÀíƽ̨ £¬github ÊdzÌÐòÔ±±Ø±¸µÄ¹¤¾ß £¬ËüÀû±ãÁË´úÂëµÄ´æ´¢ºÍÖÎÀí £¬Ò²Àû±ãÁË´úÂëµÄ½»Á÷ºÍ¹²Ïí¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚ mac µçÄÔÉϴ github µÄÇéÐΡ£

µÚÒ»²½ £¬×°Öà Git

Git ÊÇÒ»¸öÃâ·Ñ¡¢¿ªÔ´µÄÂþÑÜʽ°æ±¾¿ØÖÆϵͳ £¬ÆäÖ÷Òª×÷ÓÃÊǶÔÔ´´úÂë¾ÙÐÐÖÎÀí¡£ÔÚ Mac µçÄÔÉÏ×°Öà Git ÊǴ GitHub ÇéÐεÄÐëÒª°ì·¨¡£

Ê×ÏÈ·­¿ªÄãµÄÖÕ¶Ë £¬Ê¹ÓÃÒÔÏÂÏÂÁî×°Öà Homebrew¡£

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

µÇ¼ºó¸´ÖÆ

½Ó×ÅʹÓÃÒÔÏÂÏÂÁî×°Öà Git¡£

brew install git

µÇ¼ºó¸´ÖÆ

×°ÖÃÍê³Éºó £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÑéÖ¤ÊÇ·ñ׼ȷװÖÃÁË Git¡£

git --version

µÇ¼ºó¸´ÖÆ

µÚ¶þ²½ £¬×¢²á GitHub Õ˺Å

ÔÚʹÓà GitHub ֮ǰ £¬ÄãÐèÒªÏÈ×¢²áÒ»¸ö GitHub Õ˺Å¡£»á¼û[GitHub¹ÙÍø](https://github.com/) £¬µã»÷ÓÒÉϽǵġ°Sign up¡±×¢²á°´Å¥ £¬Æ¾Ö¤ÌáÐÑÍê³É×¢²á¡£

ÈôÊÇÄãÒѾ­ÓµÓÐÁË GitHub Õ˺Å £¬ÄÇô¿ÉÒÔÖ±½Ó¾ÙÐÐÏÂÒ»²½¡£

µÚÈý²½ £¬½¨ÉèÍâµØ¿ÍÕ»

½¨ÉèÍâµØ¿ÍÕ»²¢ÈÃËüÓë GitHub ÖеĿÍÕ»ÏàÅþÁ¬ £¬ÕâÊǴ GitHub ÇéÐεÄÒªº¦°ì·¨¡£

Ê×ÏÈÔÚÍâµØ½¨ÉèÒ»¸öĿ¼ £¬ÀýÈ磺ÔÚ×ÀÃæÉϽ¨ÉèÒ»¸öÃûΪ¡°GitHub¡±µÄÎļþ¼Ð¡£

ÔÚÖÕ¶ËÖÐʹÓà cd ÏÂÁî½øÈë¸ÃĿ¼¡£

cd ~/Desktop/
mkdir GitHub
cd GitHub/

µÇ¼ºó¸´ÖÆ

½Ó×ÅʹÓÃÒÔÏÂÏÂÁî³õʼ»¯¿ÍÕ»¡£

git init

µÇ¼ºó¸´ÖÆ

´Ëʱ Git ½«ÔÚ¸ÃÎļþ¼ÐϽ¨ÉèÒ»¸ö .git µÄÒþ²ØÎļþ¼Ð £¬Õâ¸öÎļþ¼Ð½«ÓÃÓÚ´æ´¢ Git µÄÉèÖúͿÍÕ»µÄÏà¹ØÐÅÏ¢¡£

È»ºóʹÓÃÒÔÏÂÏÂÁ¿ÍÕ»Óë GitHub µÄÔ¶³Ì¿ÍÕ»¾ÙÐйØÁª¡£

git remote add origin git@github.com:username/repo.git

µÇ¼ºó¸´ÖÆ

ÆäÖÐµÄ username ºÍ repo »®·ÖÊÇÄãµÄ GitHub Õ˺źÍÏëÒª½¨ÉèµÄ¿ÍÕ»Ãû¡£¸ÃÏÂÁ½¨Éè SSH ÅþÁ¬ £¬È·±£ÄãÒѾ­ÔÚ GitHub µÄÍøÕ¾ÖÐ[Ìí¼ÓÁËÄãµÄ SSH key ](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh)¡£

µÚËIJ½ £¬Ìá½»½ÓÂë

ÔÚÉÏÒ»°ì·¨ÖÐ £¬ÎÒÃÇÒѾ­ÈÃÍâµØ¿ÍÕ»Óë GitHub µÄÔ¶³Ì¿ÍÕ»¾ÙÐÐÁËÅþÁ¬¡£ÏÖÔÚ £¬ÎÒÃÇÒªÏò¿ÍÕ»ÖÐÌá½»Ò»¸öеÄÎļþ¡£

ÔÚ¡°GitHub¡±Îļþ¼ÐÖн¨ÉèÒ»¸öÃûΪ¡°README.md¡±µÄÎļþ £¬²¢Ìí¼ÓһЩÄÚÈÝ¡£

ʹÓÃÒÔÏÂÏÂÁ¸ÃÎļþÌí¼Óµ½¿ÍÕ»¡£

git add README.md

µÇ¼ºó¸´ÖÆ

½Ó×ÅʹÓÃÒÔÏÂÏÂÁ¸ÃÎļþÌá½»µ½ÍâµØ¿ÍÕ»¡£

git commit -m "initial commit"

µÇ¼ºó¸´ÖÆ

ÕâÀïµÄ¡°initial commit¡±¾ÍÊÇÕâ¸öÌá½»¼Í¼µÄ˵Ã÷ £¬Äã¿ÉÒÔËæÒâ¸ü¸Ä¡£

×îºóʹÓÃÒÔÏÂÏÂÁ¸ÃÎļþÍÆË͵½ GitHub µÄÔ¶³Ì¿ÍÕ»¡£

git push -u origin main

µÇ¼ºó¸´ÖÆ

ÆäÖÐµÄ main ÊÇĬÈÏ·ÖÖ§ £¬ÈôÊÇÄãÐèÒªÆäËû·ÖÖ§ £¬Çëƾ֤ÏÖÕæÏàÐξÙÐиü¸Ä¡£

µÚÎå²½ £¬Éó²éÌá½»¼Í¼

ÔÚÉÏÒ»°ì·¨ÖÐ £¬ÎÒÃÇÒѾ­Àֳɽ«ÍâµØµÄ´úÂëÌá½»µ½ÁË GitHub ÉÏ¡£ÏÖÔÚ £¬ÎÒÃÇÒªÉó²éÌá½»¼Í¼¡£

ʹÓÃÒÔÏÂÏÂÁîÉó²éÄ¿½ñ·Ö֧ϵÄËùÓÐÌá½»¼Í¼¡£

git log

µÇ¼ºó¸´ÖÆ

¸ÃÏÂÁî»áÁгöËùÓÐÌá½»¼Í¼µÄÐÅÏ¢ £¬°üÀ¨Ìá½»ÈË¡¢Ìύʱ¼ä¡¢Ìá½»¼Í¼ÐÅÏ¢µÈµÈ¡£

ÈôÊÇÄãÏëÉó²éij¸öÌá½»¼Í¼µÄÏêϸÐÅÏ¢ £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¡£

git show commit_id

µÇ¼ºó¸´ÖÆ

ÆäÖÐµÄ commit_id ÊǸÃÌá½»¼Í¼µÄ¹þÏ£Öµ £¬¿ÉÒÔͨ¹ý git log ÏÂÁîÉó²é¡£

µÚÁù²½ £¬À­È¡´úÂë

ÔÚЭ×÷¿ª·¢µÄÀú³ÌÖÐ £¬³ýÁËÐèÒªÍÆËÍ´úÂë £¬»¹ÐèҪʵʱµØÀ­È¡ËûÈ˵ĴúÂë £¬°ü¹Ü×Ô¼ºµÄÍâµØ´úÂëÓë GitHub ÉϵĴúÂë¼á³Öͬ²½¡£

ʹÓÃÒÔÏÂÏÂÁîÀ­È¡Ö÷·ÖÖ§ÉϵĴúÂë¡£

git pull origin main

µÇ¼ºó¸´ÖÆ

¸ÃÏÂÁ´ÓÔ¶³Ì¿ÍÕ»ÖÐÀ­È¡×îеĴúÂë £¬²¢½«ÆäºÏ²¢µ½ÍâµØ¿ÍÕ»ÖС£

ÈôÊÇÄúÐèÒªÀ­È¡ÆäËû·ÖÖ§µÄ´úÂë £¬Ç뽫 main Ì滻ΪÏÖʵÐèÒªÀ­È¡µÄ·ÖÖ§Ãû³Æ¡£

ÖÁ´Ë £¬ÎÒÃÇÒѾ­ÀֳɵØÔÚ Mac µçÄÔÉϴÁË GitHub ÇéÐΡ£¼ÇµÃÒ»Ö±µØѧϰºÍ¸üÐÂÄãµÄ´úÂë £¬ÓëËûÈËЭ×÷¿ª·¢¡£×£ÄãÔÚ GitHub Àֳɡ¢¿ìÀÖµØÂëÅ©Ö®Âã¡

ÒÔÉϾÍÊÇÏê½âmacÉÏÔõô´î½¨GitHubÇéÐεÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿