我完成了安装git和heroku gem的步骤,并成功地将我的应用程序推送到heroku。问题是,它显示了一个标准的“You‘’re Ruby on Rails”页面,即使我的本地应用程序设置了指向某个控制器/页面的根路径。我还从/public中删除了index.html页面。
你知道为什么会发生这种事吗?我怀疑我可能需要以某种方式从开发切换到部署,但我仍然删除了index.html,为什么它仍然显示在heroku上?
编辑:由于某些原因,转到mysite.heroku/login和我创建的其他页面工作得很好,所以不要管部署的事情。
发布于 2011-06-15 08:23:21
当您使用git并删除一个文件时,该文件不会自动从git存储库中删除。因此,当你使用git push heroku
时,这个文件仍然存在,并且会被推送到Heroku。
您可以判断git status
是否属于这种情况,它将显示如下内容:
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: public/index.html
要删除该文件,您需要使用git rm
。在这种情况下,您需要执行以下操作:
git rm public/index.html
git commit -m "Removed public/index.html"
这将从当前分支中删除该文件。
现在当你这样做的时候
git push heroku
该文件不会包含在内,因此您将被路由到routes.rb中指定的控制器。
发布于 2011-06-15 22:49:41
我总是使用git提交-am "message“。这阻止了上面的问题(肯定会发生),我不知道有什么理由不使用-am。
编辑:此外,当您有新文件要添加时,请确保使用git add .
。
所以,我的过程是:
git status (to see what has changed)
git add . (if there are new files I want to add to repository)
git commit -am "This is the comment"
git push (to github)
git push heroku (--app app-name if there is more than one app connected to this repository)
https://stackoverflow.com/questions/6351182
复制相似问题