首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

Heroku 运用

2012-07-15 
Heroku 使用http://devcenter.heroku.com/articles/quickstart这里的步骤要仔细读读。git相关报错:fatal:

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

git相关
报错: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
heroku数据库
默认用Postgresql数据库,new App会自动分配一个shared database,无法使用hero pg:psql连接。Dedicated Database无限制。

如果出现

$ heroku logsNo 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 masterTo 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 rejectedMerge 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

绑定域名
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

热点排行