让 Heroku 运行非主 Git 分支
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14593538/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Make Heroku run non-master Git branch
提问by AlexQueue
I have a project hosted on Heroku and it's gotten to the point where I want to make an alternate test server (so I can test Heroku workers without messing up production).
我有一个在 Heroku 上托管的项目,它已经到了我想要制作备用测试服务器的地步(这样我就可以测试 Heroku 工作人员而不会弄乱生产)。
I have already set up my main Heroku remote running my trunk and a Heroku-dev remote on which I wish to run an alternate branch.
我已经设置了运行主干的主 Heroku 远程和我希望运行备用分支的 Heroku-dev 远程。
My problem is that since my alternate branch isn't master, Heroku won't build it.
我的问题是,由于我的备用分支不是 master,Heroku 不会构建它。
$ git push heroku-dev test
counting objects ...
...
Pushed to non-master branch, skipping build.
To [email protected]:example-dev.git
* [new branch] test -> test
Switching this build to master is not an option at the moment. Obviously one option is to create a whole new git repo that's a clone of my test branch, but that doesn't sound very ideal.
目前无法将此版本切换到主版本。显然,一种选择是创建一个全新的 git 存储库,它是我的测试分支的克隆,但这听起来不太理想。
回答by jordelver
You can push an alternative branch to Heroku using Git.
您可以使用 Git 将替代分支推送到 Heroku。
git push heroku-dev test:master
This pushes your local test branch to the remote's master branch (on Heroku).
这会将您的本地测试分支推送到远程的主分支(在 Heroku 上)。
回答by Okpo
In my case, the default or base branch was develop, so i used:
在我的情况下,默认或基本分支是develop,所以我使用:
git push heroku develop:master
回答by john
In case git push heroku-dev test:master doesn't work for you, try git push heroku test:master. Remember the "test" in "test:master" is the name of the new branch you are on.
如果 git push heroku-dev test:master 对你不起作用,试试 git push heroku test:master。请记住,“test:master”中的“test”是您所在的新分支的名称。
回答by kingkeamo
You will need to pull the remote branch first before you can push the non master branch.
您需要先拉取远程分支,然后才能推送非主分支。
Run following command in you local repository
在本地存储库中运行以下命令
git pull https://heroku:[email protected]/YOUR_APP_NAME.git