"git push heroku master"는 푸시 할 위치와 다른 리포지토리로 푸시하는 방법을 어떻게 알 수 있습니까?
Heroku에서 호스팅되는 저장소로 푸시 할 때 다음 명령을 실행해야합니다.
git push heroku master
이 명령에서 무엇을 heroku하고 master표시합니까? git은 푸시 할 위치를 어떻게 알 수 있습니까? (git 경로)
또한 heroku rename앱 이름을 바꾸는 데 사용할 수 있는지 몰랐기 때문에 이전에 앱 이름 trytryheroku를 사용하고 있었는데 지금은 사용하고 heroku create real-thing있지만 푸시해도 여전히 trytryheroku로 푸시됩니다 ... 푸시 할 수있는 방법이 있습니까? 대신 진짜?
'heroku'부분은 설정 한 리모컨의 이름입니다. 처음으로 heroku 앱을 만들 때 애플리케이션을 가리키는 git 원격 호출 'heroku'를 만들 때-프로젝트 내에 'git remote'를 입력하면 원격 끝점을 보여줍니다. 원격의 이름으로 'heroku'를 사용하도록 제한하는 것은 없습니다. 애플리케이션에 여러 환경이있는 경우 프로덕션 또는 스테이징이라는 원격이있을 수 있습니다.
'마스터'부분은 원격으로 푸시하려는 로컬 브랜치입니다. 예를 들어 'myfeature'라는 이름의 기능 브랜치에서 개발하고이를 heroku에 배포하려는 경우 수행 할 수 있습니다.
git push heroku myfeature:master
여기에 추가 된 : master는 내 로컬 myfeature브랜치를 master원격 의 브랜치 로 푸시하는 것입니다. 참고 : heroku는 마스터 브랜치에서만 배포 할 수 있습니다.
당신은 Heroku가의 자식 원격 URL이 변경됩니다 응용 프로그램의 이름을 바꿀 경우 - 할 git remote -v당신에게 당신의 응용 프로그램 사용 REPO 힘내 표시됩니다 어떤을, 당신은 아마, 이전 Heroku가 원점을 삭제하고 새로운 하나를 추가해야합니다 git remote rm heroku다음git remote add heroku git@newgitpathfromcontrolpanel
Git에 대해 자세히 알아 보려면 이 책을 추천 합니다.
1 부 : "git은 어디로 푸시해야하는지 어떻게 알 수 있습니까?"
위에서 언급 한 명령을 실행하기 전에 :
$ git push heroku master
실행할 다른 단계는 항상 거의 없습니다. Git 및 Heroku 설치, 로컬 Git 리포지토리 만들기, heroku에 가입, 명령 줄을 통해 heroku 로그인, 호스팅 지점에 대한 heroku 핸들 만들기 ( PART 2에서 설명 )
1. 로컬 Git 저장소 :
$ git init
Initialized empty Git repository in .git/
$ git add .
$ git commit -m "my first commit"
Created initial commit 5df2d09: my first commit
44 files changed, 8393 insertions(+), 0 deletions(-)
create mode 100644 README
create mode 100644 Procfile
create mode 100644 app/controllers/source_file
...
2. Heroku에 가입 (ed)하고 명령 줄을 통해 로그인합니다.
$ heroku login
Enter your Heroku credentials.
Email: user@example.com
Password:
Could not find an existing public key.
Would you like to generate one? [Yn]
Generating new SSH public key.
Uploading ssh public key /Users/adam/.ssh/id_rsa.pub
따라서 실행 $ git push heroku master하여 코드 / 앱을 Heroku에 푸시했습니다.
파트 2 :하지만 heroku 와 master 는 무엇을 나타 냅니까?
Heroku보다 Git 질문에 가깝습니다. Heroku는 배포를 위해 Git (Distributed Version Control System)에 의존하는 호스팅 플랫폼입니다.
'푸시'의 기본 개념은 로컬로 (작업 머신에) 가지고있는 일부 (파일, 앱, ..)를 다른 곳,이 경우 원격 저장소 (원격 머신)로 푸시하는 것입니다.
'push'를 사용하기 전에 Git에서 원격 저장소 (전체 URL)에 대한 참조 역할을하는 원격 (핸들)을 만듭니다. 다음 명령을 사용하여 수행합니다.
$ git remote add <remote-name-of-our-choice> <URL-where-you-be-pushing-yourapp>
'push'명령의 기본 구조는 다음과 같습니다.
$ git push <remote-name> <branch>
So $ git push heroku master is actually pushing your code/app/file (from some local Git repo) to a remote repo 'heroku' .
wondering when this 'heroku' remote got created, it was added when you executed $ heroku create
$ heroku create
Creating stark-fog-398... done, stack is cedar
http://stark-fog-398.herokuapp.com/ | git@heroku.com:stark-fog-398.git
Git remote heroku added
Do notice the last line "Git remote heroku added".
to make it more clear, here's a Git command to check/output all the remotes: $ git remote -v will display something similar to the following
$ git remote -v
heroku git@heroku.com:somerepo.git (fetch)
heroku git@heroku.com:somerepo.git (push)
So we can assume that the following command was executed (implicitly) somewhere, when you did $ heroku create , hence creating the heroku remote to some heroku repo (url)*
$ git remote add heroku git@heroku.com:somerepo.git
heroku is required as part of the heroku gem to assist with the push, and master is simply the git branch you are pushing. The git knows where to push to because you create a heroku application the push is automatically setup, which you can see by typing
git remote -v
if you need to change that remove it with git remote rm heroku and then add yoru new application with git remote add heroku git@heroku.com:your-application-15.git
Just like you I also struggled to understand these nitty gritty of git and heroku and I was confused too. But now I have got bit of clarity to be able to answer your question in short.
Assuming you have git setup on your project directory. There exist a .git hidden folder in your project folder that contains a file named "config" this holds all information about remotes.
Remotes are your individual repositories named individually like origin, heroku, staging, prod etc..
In your command heroku stands for the repository you have mapped to heroku project. Open config file you will see the URL.
When you run
git push heroku master
you're telling git to push your current origin repository's master branch to heroku repository's master branch
Rest all details are already shared in other answers so donot want to repeat. So this is just a short answer per my understanding. Hope it helps.
Other answers great for the first half of your question...
Here's the succinct answer to the second half.
via https://devcenter.heroku.com/articles/renaming-apps#updating-git-remotes
git remote rm heroku
heroku git:remote -a name-of-heroku-app
'programing tip' 카테고리의 다른 글
| 좋은 자바 스크립트 시간 선택기는 무엇입니까? (0) | 2020.09.19 |
|---|---|
| 누락 된 상위 디렉토리와 함께 새 파일을 만드는 방법은 무엇입니까? (0) | 2020.09.19 |
| g ++에 라이브러리 경로를 어떻게 포함합니까? (0) | 2020.09.19 |
| C ++ : 생성자에서 변수를 초기화 할 위치 (0) | 2020.09.19 |
| 글로벌 네임 스페이스가 오염된다는 것은 무엇을 의미합니까? (0) | 2020.09.19 |