developer tip

기존 Heroku 앱과 폴더를 연결하는 방법

optionbox 2020. 9. 29. 07:38
반응형

기존 Heroku 앱과 폴더를 연결하는 방법


GitHub에 기존 Rails 앱이 있고 Heroku에 배포되었습니다. 새 개발 시스템을 설정하려고하고 내 GitHub 저장소에서 프로젝트를 복제했습니다. 그러나이 폴더를 Heroku에 연결하는 방법에 대해 혼란 스럽습니다. 원래는 heroku create명령을 사용 했지만 이번에는 다른 Heroku 인스턴스를 만들 것이기 ​​때문에 분명히하고 싶지 않습니다.


Herokuherokugit remote (및 몇 가지 다른 옵션, 아래 업데이트 참조)를 기반으로 프로젝트를 연결합니다 . 현재 저장소에서 Heroku 리모컨을 리모컨으로 추가하려면 다음 명령을 사용하십시오.

git remote add heroku git@heroku.com:project.git

여기서는 projectHeroku 프로젝트의 이름입니다 ( project.heroku.com하위 도메인 과 동일 ). 그런 다음 heroku xxxx명령을 사용하고 ( Heroku Toolbelt가 설치되어 있다고 가정 ) .NET을 통해 평소처럼 Heroku로 푸시 할 수 있습니다 git push heroku master. 바로 가기로 명령 줄 도구를 사용하는 경우 다음을 입력 할 수 있습니다.

heroku git:remote -a project

여기에서도 projectHeroku 프로젝트의 이름입니다 (고마워요, Colonel Panic ). 을 전달하여 원하는대로 Git 원격 이름을 지정할 수 있습니다 -r remote_name.

[최신 정보]

주석에서 Ben이 언급했듯이 heroku, gem 명령이 작동하기 위해 리모컨의 이름을 지정할 필요가 없습니다 . 소스를 확인한 결과 다음 과 같이 작동하는 것 같습니다.

  1. --app옵션 (예 :)을 통해 앱 이름을 지정하면 heroku info --app myapp해당 앱이 사용됩니다.
  2. 옵션 (예 :)을 통해 Git 원격 이름 을 지정하면 해당 Git 원격과 연결된 앱을 사용합니다.--remoteheroku info --remote production
  3. 옵션을 지정하지 않고 heroku.remoteGit 구성 파일에 설정 한 경우 해당 리모컨과 연결된 앱을 사용합니다 (예 : git config heroku.remote production저장소에서 기본 리모컨을 "프로덕션"사용으로 설정 하고 Heroku가 실행 git config heroku.remote되어 값을 읽음) 이 설정의)
  4. 옵션을 지정하지 않으면 gem은 .git/config파일 에서 구성을 찾지 않고 Git 리모컨에서 URL에 "heroku.com"이있는 리모컨 하나만 찾으면 해당 리모컨을 사용합니다.
  5. 이 중 어느 것도 작동하지 않으면 명령을 전달하라는 오류가 발생 --app합니다.

에게 Heroku CLI는 이것에 대한 쉬운 바로 가기가 있습니다. 'falling-wind-1624'라는 앱의 경우 :

$ heroku git:remote -a falling-wind-1624
Git remote heroku added.

참조 https://devcenter.heroku.com/articles/git#creating-a-heroku-remote를


이전에 heroku를 설정 한 적이없는 머신에도 있다면 잊지 마세요.

heroku keys:add

또는 리포지토리로 밀거나 당길 수 없습니다.


Heroku의 포크 사용

  1. 새로운 "heroku fork"명령을 사용하십시오! 모든 환경을 복사하고 이후에 github 저장소를 업데이트해야합니다!

    heroku fork -a sourceapp targetapp
    
  2. 로컬 복제

    git clone git@heroku.com:youamazingapp.git
    
  3. github에서 새 저장소를 만들고 추가하십시오.

    git remote add origin https://github.com/yourname/your_repo.git
    
  4. github에 푸시

    git push origin master
    

이전 앱의 새 배포 시스템을 설정할 때주의해야 할 두 가지

1. Heroku에 대한 앱 액세스를 확인하려면 (특히 앱)

heroku apps

it will list the apps you have access to if you set up for the first time, you probably need to

heroku keys:add

2. Then set up your git remote

For already created Heroku app, you can easily add a remote to your local repository with the heroku git: remote command. All you need is your Heroku app’s name:

heroku git:remote -a appName

you can also rename your remotes with the git remote rename command:

git remote rename heroku heroku-dev(you desired app name)

then You can use the git remote command to confirm that a remote been set for your app

 git remote -v

You should probable start ssh-agent and add your keys. Check this,

http://wordgraphs.com/post/5000/Heroku--Permission-denied--publickey---fatal--Could-not-read-from-remote-repository-

It helped me.


I've my project in github and heroku, for upload an heroku use :

heroku git:remote -a <project>

The doc it is:

https://devcenter.heroku.com/articles/git

참고URL : https://stackoverflow.com/questions/5129598/how-to-link-a-folder-with-an-existing-heroku-app

반응형