$ npm i gh-pages
{
"script": {
// ...
"build": "react-scripts build",
"deploy": "gh-pages -d build", // 배포 브랜치 gh-pages 에 build 폴더 push
"predeploy": "npm run build" // 프로젝트 디렉터리 빌드
},
"homepage": "<https://hxxtae.github.io/>(remote repository-name)"
}
repository가 없으면 새로 만들고 remote를 http 방식이 아닌 ssh 방식으로 다시 연결 시켜 준다.
repository가 있으면 remote를 ssh 방식으로 다시 연결 시켜 준다.
( remote가 http로 연결 되어 있으면 git remote rm origin
으로 연결을 끊어 준다. )
$ git remote add origin [email protected]:hxxtae/(repository name).git
$ git remote update
$ git remote -v
$ git push --set-upstream origin (branch name)
gh-pages
이름으로 새로운 branch 생성하여 원격 저장소(origin)에도 연결해 준다.$ npm run deploy