git´î½¨laravelÇéÐÎ
ÔÚ¾ÙÐÐlaravel¿ª·¢Ö®Ç°£¬ÎÒÃÇÐèÒªÏȴºÃlaravelµÄ¿ª·¢ÇéÐΡ£¶øÔڴÇéÐεÄÀú³ÌÖУ¬Ê¹ÓÃgit¾ÙÐдúÂëÖÎÀíÊÇÒ»¸ö²»´íµÄÑ¡Ôñ¡£git²»µ«¿ÉÒÔ×ÊÖúÎÒÃÇÖÎÀí°æ±¾£¬»¹¿ÉÒÔΪÎÒÃÇÌṩÐ×÷¿ª·¢µÄ±ãµ±¡£Òò´Ë£¬±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃgit´î½¨laravelÇéÐΡ£
Ò»¡¢×°ÖÃGit
Ê×ÏÈ£¬ÎÒÃÇÐèҪװÖÃGit¡£GitÊÇÒ»¸öÃâ·ÑµÄ¿ªÔ´°æ±¾¿ØÖÆϵͳ£¬Ö§³Ö¶àÖÖƽ̨¡£ÔÚLinuxϵͳÉÏ£¬¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°ÖÃGit£º
sudo apt-get update
sudo apt-get install git
WindowsºÍMacOSϵͳÏ£¬¿ÉÒÔÇ°ÍùGit¹ÙÍøÏÂÔØ×°ÖóÌÐò¾ÙÐÐ×°Öá£
×°ÖÃÍê³Éºó£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî¼ì²éGitÊÇ·ñÀÖ³É×°Öãº
git –version
¶þ¡¢½¨ÉèLaravelÏîÄ¿
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒª½¨ÉèÒ»¸öLaravelÏîÄ¿£¬ÕâÀïÎÒÃÇʹÓÃcomposerÏÂÁîÀ´½¨Éè¡£ÔÚÖÕ¶ËÊäÈëÒÔÏÂÏÂÁ
composer create-project –prefer-dist laravel/laravel mynewlaravel
ÕâÀïÎÒÃǽ«ÏîÄ¿ÃûÉèÖÃΪmynewlaravel£¬Äã¿ÉÒÔƾ֤×Ô¼ºµÄÐèÒªÐ޸ġ£
½¨ÉèÍê³Éºó£¬½øÈëÏîÄ¿Îļþ¼Ð²¢³õʼ»¯Git£º
cd mynewlaravel
git init
Èý¡¢Ìí¼ÓLaravelÇéÐÎÎļþ
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒª½«LaravelÇéÐÎÎļþÌí¼Óµ½Git¿ÍÕ»ÖС£LaravelÇéÐÎÎļþÈÏÕæ´æ´¢ÏîÄ¿µÄÉèÖÃÐÅÏ¢£¬ºÃ±ÈÊý¾Ý¿âÐÅÏ¢¡¢»º´æÉèÖõȵȡ£ÔÚLaravelÖУ¬ÇéÐÎÎļþͨ³£ÃüÃûΪ.env£¬ÔÚн¨ÉèµÄLaravelÏîÄ¿ÖУ¬Äã¿ÉÒÔÔÚ¸ùĿ¼ÖÐÕÒµ½Ò»¸öÃûΪ.env.exampleµÄÎļþ¡£
ÎÒÃÇÐèÒª½«.env.exampleÎļþ¸´ÖÆÒ»·Ý£¬²¢½«ÆäÃüÃûΪ.env£º
cp .env.example .env
½ÓÏÂÀ´ÔËÐÐÒÔÏÂÏÂÁ
php artisan key:generate
Õâ¸öÏÂÁî»áΪÏîÄ¿ÌìÉúÒ»¸öΨһµÄÃØÔ¿£¬²¢½«ÆäÌí¼Óµ½.envÎļþÖС£ÓÉÓÚ.envÎļþÖаüÀ¨Ãô¸ÐÐÅÏ¢£¬ÎÒÃÇÓ¦¸ÃÈ·±£.gitignoreÎļþÖн«Æäɨ³ýÔÚGit¿ÍÕ»Ö®Íâ¡£·¿ª.gitignoreÎļþ£¬Ìí¼ÓÒÔÏÂÄÚÈÝ£º
Ignore .env file
.env
È»ºóÌá½»ÕâЩ¸ü¸Äµ½Git¿ÍÕ»£º
git add .env
git add .gitignore
git commit -m “Add .env and .gitignore files”
ËÄ¡¢ÐÞ¸ÄLaravelÉèÖÃ
ÔÚÔËÐÐLaravel֮ǰ£¬ÎÒÃÇÐèÒªÔÚ.envÎļþÖÐÐÞ¸ÄÏîÄ¿ÉèÖÃÐÅÏ¢¡£ÔÚÕâ¸öÎļþÖУ¬Äã¿ÉÒÔÉèÖÃLaravelµÄÊý¾Ý¿âÅþÁ¬¡¢»º´æЧÀÍ¡¢ÓʼþЧÀ͵ȵȡ£
ÀýÈ磬ÈôÊÇÄãʹÓõÄÊÇMySQLÊý¾Ý¿â£¬ÄÇô¿ÉÒÔÉèÖÃÒÔÏÂÄÚÈÝ£º
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mynewlaravel
DB_USERNAME=root
DB_PASSWORD=
ÆäÖÐDB_DATABASE¡¢DB_USERNAMEºÍDB_PASSWORDµÈӦƾ֤Äã×Ô¼ºµÄÐèÇó¾ÙÐÐÐ޸ġ£Íê³Éºó£¬Ìá½»¸ü¸Äµ½Git¿ÍÕ»£º
git add .env
git commit -m “Update Laravel project configuration”
Îå¡¢Ìí¼ÓLaravelÒÀÀµ
ÏÂÒ»²½£¬ÎÒÃÇÐèÒªÏòLaravelÏîÄ¿ÖÐÌí¼ÓËùÐèµÄÒÀÀµ¡£Laravelͨ¹ýComposerÀ´ÖÎÀíÒÀÀµ£¬Òò´ËÎÒÃÇÐèÒªÏÈÔÚÏîÄ¿¸ùĿ¼ÖÐÔËÐÐÒÔÏÂÏÂÁÏÂÔØËùÐèµÄÒÀÀµ£º
composer install
È»ºó£¬½«vendorĿ¼Ìí¼Óµ½Git¿ÍÕ»ÖУº
git add vendor/
git commit -m “Add Laravel dependencies”
Áù¡¢Ìá½»¸ü¸Ä
×îºó£¬ÎÒÃÇÐèÒª½«ËùÓиü¸ÄÌá½»µ½Git¿ÍÕ»ÖУº
git add .
git commit -m “Finalize project setup”
Æß¡¢Íê³É
ÏÖÔÚ£¬LaravelÇéÐÎÒѾ´î½¨Íê³É²¢ÉÏ´«ÖÁGit¿ÍÕ»ÖС£ÔÚ¿ª·¢Àú³ÌÖУ¬Äã¿ÉÒÔͨ¹ýGitÀ´ÖÎÀí´úÂ룬±ãÓÚ°æ±¾¿ØÖƺÍÐ×÷¿ª·¢¡£
×ÛÉÏËùÊö£¬±¾ÎÄÏÈÈÝÁËÔõÑùʹÓÃGitÀ´´î½¨LaravelÇéÐΣ¬²¢½«ÆäÉÏ´«ÖÁGit¿ÍÕ»¡£Ï£Íû¶ÔÄãÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇgit´î½¨laravelÇéÐεÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡