如何“git push heroku master”知道在哪里推动和如何推到不同的回购? [英] How does "git push heroku master" know where to push to and how to push to a different repo?

查看:95
本文介绍了如何“git push heroku master”知道在哪里推动和如何推到不同的回购?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在推送到Heroku上的存储库时,必须执行以下命令:

  git push heroku master 

heroku master 在此命令中指示? git如何知道在哪里推动? (git路径)

另外,我不知道我可以使用 heroku rename 来重命名应用程序,所以之前说,我使用的应用程序名称trytryheroku,现在我用 heroku创建真实的东西但如果我推,它仍然推动trytryheroku ...有没有办法推到真实的东西呢? 解决方案

'heroku'部分是您设置的远程名称 - 你第一次创建一个Herku应用程序时,它会创建一个指向你的应用程序的git远程调用'heroku' - 如果你在你的项目中键入'git remote',它会向你显示远程终端。没有什么能够锁定你使用'heroku'作为远程的名字 - 如果你的应用有多个环境,你可能会有远程命令例如production或staging。



'主'部分是您希望推送到远程的本地分支。如果你在一个名为'myfeature'的特性分支中开发,并且你想将它部署到heroku中,你可以这样做;

  git push heroku myfeature:master 

额外:master这里是说推送我的本地 myfeature 分支到远程的 master 分支 - 注意:heroku只能从主分支部署。



如果您重命名应用程序,那么heroku git远程URL将发生更改 - 执行 git remote -v ,这会向您显示您的应用程序正在使用的git repo,您可能需要删除旧的heroku源,并添加新的 git remote rm heroku 然后 git remote add heroku git @ newgitpathfromcontrolpanel



要了解有关Git的更多信息,我会推荐 a> book


When pushing to a repository hosted on Heroku one must execute the following command:

git push heroku master

What do heroku and master indicate in this command? How does git know where to push to? (the git path)

Also, I didn't know I can use heroku rename to rename an app, so before, say I was using the app name trytryheroku and now I use heroku create real-thing but if I push, it still pushes to trytryheroku... is there a way to push to real-thing instead?

解决方案

The 'heroku' part is the name of the remote that you have setup - when you create a heroku app the first time it creates a git remote call 'heroku' pointing at your application - if you type 'git remote' within your project it will show you the remote endpoints. There's nothing locking you into using 'heroku' as the name of the remote - if you have multiple environments for your application you may have remotes named production or staging for example.

The 'master' part is the local branch you wish to push to the remote. If you develop in a feature branch for example named 'myfeature' and you want to deploy that to heroku you would do;

git push heroku myfeature:master

the additional :master here is saying push my local myfeature branch into the master branch on the remote - note: heroku can only deploy from the master branch.

If you rename an app the heroku git remote url will change - do a git remote -v which will show you the git repo your app is using, you will probably need to delete your old heroku origin and add the new one, git remote rm heroku then git remote add heroku git@newgitpathfromcontrolpanel

To learn more about Git I would recommend this book

这篇关于如何“git push heroku master”知道在哪里推动和如何推到不同的回购?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆