- 安裝 Node.js
- 安裝git
- 打開Node.js Command
-
打上 npx create-react-app your-app-name
- 輸入 cd your-app-name
- 打開 ./you-app-name 資料夾裡的 package.json 檔
- 在裡面加入
“homepage”: “http://youraccout.github.io/your-app-name“
….scripts”: {
“predeploy”: “npm run build”,
“deploy”: “gh-pages -d build”
}
如下圖
- 在裡面加入

6. 去github網站,創建你的repository 名字要和你的your-app-name相同
7. 複製你的repository的 git 如下圖 找不到也可以用打的 https://github.com/youraccount/your-app-name.git


8. 在command line上打
git init
git remote add origin https://github.com/youraccount/your-app-name.git
(此時需要輸入github帳密)
git add .
git commit -m “Your awesome message”
git push origin master
npm run deploy
9. 完成後 http://youraccout.github.io/your-app-name
看你的第一個在github上React程式吧
@copyright MRcodingRoom
觀看更多文章請點MRcoding筆記
觀看更多文章請點MRcoding筆記