developer's diary

最近はc#のエントリが多いです

gitに記録しながらlaravel8.xプロジェクト作成の記録 (1)

Mac Bookで構築

ミドルウェアはMAMPで構成

1. githubのプロジェクト作成

f:id:mitsugi-bb:20210318190412p:plain

作成すると次の画面に遷移します。

f:id:mitsugi-bb:20210318190521p:plain

2. githubにファイル追加

2. - (1)「/Applications/MAMP」に、「MyApp」というディレクトリを作成

mkdir /Applications/MAMP/MyApp

2. - (2) カレントディレクトリを「/Applications/MAMP/MyApp」に移動

cd /Applications/MAMP/MyApp 

2. - (3) README.mdファイルを作成、内容は「# MyApp」

echo "# MyApp" >> README.md

2. - (4) カレントディレクトリをgit の管理対象にする

git init

結果

Initialized empty Git repository in /Applications/MAMP/MyApp/.git/

2. - (5) README.mdをステージング

git add README.md

2. - (6) commit実行、コミットコメントは「first commit」

git commit -m "first commit"

結果

[master (root-commit) 2363764] first commit
 1 file changed, 1 insertion(+)
 create mode 100644 README.md

2. - (7) ブランチ名を「main」に変更

git branch -M main

2. - (8) リモートリポジトリを追加

git remote add origin https://github.com/mitsugeek/MyApp.git

2. - (9) push実行と同時に、push先をリモートリポジトリとして認識させる

git push -u origin main

結果

Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 216 bytes | 216.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/mitsugeek/MyApp.git
 * [new branch]      main -> main
Branch 'main' set up to track remote branch 'main' from 'origin'.

2. - (10) git にpushされた。

f:id:mitsugi-bb:20210318235646p:plain

github.com

3. laravelプロジェクト作成

composer create-project laravel/laravel laravel 

4. gitにコミット

4. - (1) 全てのフィアルをステージング

git add .

4. - (2) コミット(コミットコメントは、「laravel install」

git commit -m "laravel install"

4. - (3) push実行

git push

結果

f:id:mitsugi-bb:20210319001351p:plain

github.com

5. ブラウザから表示できるようにする

5. - (1) シンボリックリンクを追加

http://localhost:8888/MyApp/にアクセスがあった場合に、/Applications/MAMP/MyApp/laravel/publicを表示するようにシンボリックリンクを貼る。

ln -s /Applications/MAMP/MyApp/laravel/public /Applications/MAMP/htdocs/MyApp 

5. - (2) ブラウザから表示してみる

http://localhost:8888/MyApp/にアクセスする。

f:id:mitsugi-bb:20210319001844p:plain

続きはこちら。

mitsugeek.net