Skip to content

Instantly share code, notes, and snippets.

@sigridjineth
Last active November 2, 2021 11:54
Show Gist options
  • Save sigridjineth/8da1c67350ee03f8a1cd4bbd654b1557 to your computer and use it in GitHub Desktop.
Save sigridjineth/8da1c67350ee03f8a1cd4bbd654b1557 to your computer and use it in GitHub Desktop.
API 헤로쿠에 배포하기

API 헤로쿠로 배포하기

Git subtree 간단하게 알아보기

  • git subtree는 실제로 개별 프로젝트인 여러 개의 프로젝트를 개발자의 로컬에서는 하나의 repo로 관리할 수 있게 해준다.
    • 우리 회원가입 프로젝트의 경우 BE/FE/iOS 별도의 폴더로 관리되고 있는 데 이를 하나의 레포로 관리할 수 있다.
  • Parent와 Child가 있고 폴더 별로 분리되는 프로젝트가 Child라고 이해하면 된다.
  • Child의 경우 git subtree push, git subtree pull 로 깃 명령을 사용해야 한다.

헤로쿠로 폴더 별 프로젝트 배포하기

  • 먼저 heroku.com에 접속해서 헤로쿠 앱을 만든다.
  • 터미널에 Heroku CLI를 설치한다.
brew tap heroku/brew && brew install heroku
  • 설치가 완료되면 헤로쿠로 로그인한다.
heroku login
  • 로그인이 완료되면 remote upstream에 heroku를 설정한다. Github의 origin이 아니라 heroku에 푸시해서 배포한다.
heroku git:remote -a 헤로쿠 앱 이름
  • 우리는 BE-workspace 폴더 내에 있는 프로젝트를 배포한다고 가정한다.
  • 아래 명령어를 활용하여 heroku에 우리의 BE-workspace 폴더 내부 프로젝트를 푸시한다. 참고 링크
git subtree push --prefix BE-workspace heroku master

오류 해결

  • 만약 오류가 발생한다면 force push를 시도해본다.
  • 참고로 무조건 heroku master에 배포한다.
git subtree push --prefix BE-workspace heroku master --force
git push -f heroku 로컬 브랜치 이름:master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment