git 如何将更改直接从 Cloud9 IDE 推送到 Heroku?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5340709/
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
How can I push changes directly from Cloud9 IDE to Heroku?
提问by Nathan Bashaw
I'm a (non-technical) intern at a place where I can't use my normal laptop, and I have a lot of free time. I'm learning how to program, and I'd like to be able to use a completely cloud-based development environment, because I can't install anything on the computer I have access to here.
我是一名(非技术)实习生,在我无法使用普通笔记本电脑的地方,我有很多空闲时间。我正在学习如何编程,我希望能够使用完全基于云的开发环境,因为我无法在我可以访问的计算机上安装任何东西。
I signed up for Cloud9 IDE, connected it to my GitHub account, and cloned a repo containing a little Sinatra project I'm working on. The problem is, I don't know how to push any changes I make in Cloud9 to Heroku. Basically I'm flying blind. If I were on my laptop, I'd just hop on terminal, commit my changes, and run git push heroku master
. At work, that's not an option, since I'm not developing anything locally. Cloud9 has a console built in with git installed, so I tried installing rubygems by running git clone https://github.com/rubygems/rubygems.git
so I could install the heroku gem, but I couldn't figure out how to unpack / install it.
我注册了 Cloud9 IDE,将其连接到我的 GitHub 帐户,并克隆了一个包含我正在处理的 Sinatra 小项目的存储库。问题是,我不知道如何将我在 Cloud9 中所做的任何更改推送到 Heroku。基本上我是盲目飞行。如果我在我的笔记本电脑上,我会跳上终端,提交我的更改,然后运行git push heroku master
. 在工作中,这不是一个选择,因为我没有在本地开发任何东西。Cloud9 内置了一个安装了 git 的控制台,所以我尝试通过运行来安装 rubygems,git clone https://github.com/rubygems/rubygems.git
这样我就可以安装 heroku gem,但是我不知道如何解压/安装它。
Am I on the right path? Any suggestions as to how I can develop entirely in the cloud?
我在正确的道路上吗?关于如何完全在云中开发有什么建议吗?
回答by ConfusedNoob
First, you need to add the remote github repo:
首先,您需要添加远程 github 存储库:
git remote add origin [email protected]:username/yourapp.git
git push origin master
You'll then probably get: "Permission Denied (publickey)".
然后你可能会得到:“权限被拒绝(公钥)”。
You have to tell github about the SSH key that cloud9ide is using. You can see your SSH key on the cloud 9 dashboard at http://cloud9ide.com/dashboard.htmlby clicking the 'show your SSH key' link.
您必须将 cloud9ide 正在使用的 SSH 密钥告诉 github。通过单击“显示您的 SSH 密钥”链接,您可以在http://cloud9ide.com/dashboard.html的 cloud 9 仪表板上看到您的 SSH 密钥。
Click the copy button to copy your SSH key to the clipboard. Now, head on over to github.com. Login and click Account Settings. Choose the 'SSH Public Keys' option and 'Add another public key'. Save your changes. You are now, good to go and can push from your cloud9 repo.
单击复制按钮将您的 SSH 密钥复制到剪贴板。现在,前往 github.com。登录并单击帐户设置。选择“SSH 公钥”选项和“添加另一个公钥”。保存您的更改。现在,一切顺利,可以从您的 cloud9 存储库推送。
回答by dkastner
It looks like you should be able to run git remote add heroku [email protected]:<application>.git
and then git push heroku master
看起来你应该能够运行git remote add heroku [email protected]:<application>.git
然后git push heroku master
回答by tgkokk
回答by J_McCaffrey
You can use cloud9 to manage a github repo and deploy to heroku. I just did this task today, for an open source demo site for captcha plugins for Rails, after someone pointed outthat my demo site had a broken link.
您可以使用 cloud9 来管理 github 存储库并部署到 heroku。在有人指出我的演示站点的链接已损坏之后,我今天刚刚为 Rails 验证码插件的开源演示站点完成了这项任务。
The steps are detailed very clearly here
My steps:
我的步骤:
- log in to cloud9ide.com (I use my github credentials)
- pull down project from github listings
- edit files
- in command line (at the bottom of the cloud9 page) git commit -am "fix the issue"
- click deploy, select 'simple-captcha-demo' from heroku list (I had already connected)
- click "Yes" to have cloud9 create a package.json file
- manually create a blank Procfile (to get past next error)
- git commit -am to push that Procfile out
- click deploy again
- confirm that my changes were deployed
- 登录 cloud9ide.com(我使用我的 github 凭据)
- 从 github 列表中下拉项目
- 编辑文件
- 在命令行中(在 cloud9 页面底部) git commit -am “修复问题”
- 单击部署,从 heroku 列表中选择“simple-captcha-demo”(我已经连接)
- 单击“是”让 cloud9 创建 package.json 文件
- 手动创建一个空白的 Procfile(以克服下一个错误)
- git commit -am 将 Procfile 推出
- 再次点击部署
- 确认我的更改已部署
Once you get past the 2 errors, the flow would just be
一旦你克服了 2 个错误,流程就会变成
- edit your files
- git commit -am 'your commit message'
- deploy to heroku
- git push origin master # to push changes up to github
- 编辑你的文件
- git commit -am '你的提交信息'
- 部署到heroku
- git push origin master # 将更改推送到 github
回答by StewartArmbrecht
Here is what I did (I already had my project connected to github):
这是我所做的(我已经将我的项目连接到 github):
After creating the project connected to github:
创建项目后连接github:
- Run 'git remote add heroku [email protected]:[projectname].git' Sub in your project name. Ex: [email protected]:gherkinrunner.git
- Then follow these directions: https://docs.c9.io/deploying_via_cli.html
- Then navigate back to your workspace (/home/ubuntu/workspace) in the cloud9 ide terminal
- Run 'heroku login' and login using your credentials.
- Run 'heroku keys:add'
- Run 'git push heroku'
- 在您的项目名称中运行 'git remote add heroku [email protected]:[projectname].git' Sub。例如:[email protected]:gherkinrunner.git
- 然后按照以下说明操作:https: //docs.c9.io/deploying_via_cli.html
- 然后在 cloud9 ide 终端导航回您的工作区(/home/ubuntu/workspace)
- 运行“heroku login”并使用您的凭据登录。
- 运行“heroku 键:添加”
- 运行'git push heroku'
That's it for me.
对我来说就是这样。