1, Git
详细参考 http://help.github.com/linux-set-up-git/ 完成:
(1)Git 安装(一般安装了RoR,这Git早就安装好了);
(2)生成SSH;
Quick Guide 1:Creating and Commiting
$ cd (project-directory) $ git init $ (add some files) $ git add . $ git commit -m 'Initial commit'
Git 与 Heroku 结合: http://devcenter.heroku.com/articles/git
别人的总结参考:
http://guibin.iteye.com/blog/1014369
http://suiaing.wordpress.com/2010/07/11/git%E5%9F%BA%E6%9C%AC%E6%B5%81%E7%A8%8B/
Quick Guide 2:Cloning and Creating a Patch
$ git clone git://github.com/git/hello-world.git $ cd hello-world $ (edit files) $ git add (files) $ git commit -m 'Explain what I changed' $ git format-patch origin/master
2. Heroku
安装heroku gem : $gem install heroku
详细参考: http://devcenter.heroku.com/articles/quickstart
(1) Track your application with Git
$cd PATH/TO/MY_APP
$git init
Initialized empty Git repository in .git/
$git add .
$git commit -m "commit new app"
Created initial commit 5df2d09: new app
44 files changed, 8393 insertions(+), 0 deletions(-)
(2) Set up your SSH keys, 参考1中的http://help.github.com/linux-set-up-git/
创建完SSH keys后,将其添加到heroku:
heroku keys:add
(3) Create your Heroku application
$heroku create
Enter your Heroku credentials.
Email: joe@example.com
Password:
Uploading ssh public key /Users/joe/.ssh/id_rsa.pub
Created http://high-sunrise-58.heroku.com/ | git@heroku.com:high-sunrise-58.git
Git remote heroku added
可以重命名 application, 进入RoR, application的目录, 运行: heroku rename new_name。 当然最简单的还是创建时命名:
heroku create app_name
;
(4) Push your application to Heroku
$git push heroku master
(5) Bootstrap your database
$heroku rake db:migrate
Next Steps
Now that your application is running, it’s easy to push updates:
1. Develop and test changes locally.
2. Commit code to git :$ git commit -a ("-a" represents committing all changed files).
3. Push your changes to Heroku with :$git push heroku
4. Don't forget to migrate database when db change.