Heroku 使用

http://devcenter.heroku.com/articles/quickstart这里的步骤要仔细读读。

[b]git相关[/b]
报错:fatal: 'heroku' does not appear to be a git repository需要:
git remote add diancai git@heroku.com:diancai.git解决
git push diancai master这一句如果执行没反应,需要看http://devcenter.heroku.com/articles/git-repository-ssh-fingerprints
by adding the following lines to your ~/.ssh/config
Host heroku.com
VerifyHostKeyDNS yes
$ git remote add diancai git@heroku.com:diancai.git
$ git push diancai master
$ git push -f diancai master可以强制提交代码或者git push diancai +master
$ git clone -o diancai git@heroku.com:diancai.git 克隆服务器的代码-o 是给下载后的文件夹取名叫diancai.所以heroku可以用于代码备份,^_^

heroku open

heroku db:migrate报错:主要是pg没装,heroku要求有pg,本地倒是不许要,所以在Gemfile中:
group :production do
# gems specifically for Heroku go here
gem "pg"
end
然后$bundle install --without production

现在git add .
commit push上去OK啦。
如果有错误,查看错误:$heroku logs
rails3.1发布到heroku需要asset pipline,而开发模式下并没有compose,所以发布到heroku的production需要改下config/environments/production.rb里config.assets.compile = true
[b]heroku数据库[/b]
默认用Postgresql数据库,new App会自动分配一个shared database,无法使用hero pg:psql连接。Dedicated Database无限制。

如果出现
$ heroku logs
No app specified.
Run this command from an app folder or specify which app to use with --app <app name>
错误,可能是因为在另外一个目录,不是最初的目录,因此git push也必须要-f才能提交成功。将最初目录文件清空,将最新文件拷贝到最初的目录,然后将最初的目录改名,就可以正常使用了。

$ git push diancai master
To git@heroku.com:diancai.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com:diancai.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
出现这样的错误我也只能是通过强制提交解决了。即$ git push diancai +master

[b]绑定域名[/b]
http://devcenter.heroku.com/articles/custom-domains
需要绑定信用卡了。


参考文章:http://stackoverflow.com/questions/922210/unable-to-git-push-master-to-github
http://stackoverflow.com/questions/7296683/rails-3-1-pushing-to-heroku-errors-installing-postgres-adapter
http://stackoverflow.com/questions/4574176/heroku-push-rejected-failed-to-install-gems-via-bundler
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值