01 Nov 2007

Using Git to Manage and Deploy your Rails Apps


Git with Rails Tutorial from Scott Chacon on Vimeo.
Update: I just published a mini-book on Git called Git Internals through PeepCode Press ($9) that goes into a lot more detail on Git and includes about an hour of associated short screencasts, if you'd like to learn more.



Git and Rails

I produced a rather in-depth (~30 min) screencast about using Git with Rails and Capistrano 2.1, since Cap now includes a Git SCM module and I've been finding that a number of Rails people are getting more interested in using Git.
In this screencast, I talk about how to deploy and develop Rails applications using Git. Specifically, I go over:
  • Installing Git
  • Creating a new Rails App and Initializing a Git repo for it
  • Cloning and publishing an external repository for that app
    • git clone --bare
    • scp git@gitserver:/opt/repos/notetaker.git
    • git remote add gitserver git@gitserver:/opt/repos/notetaker.git
    • cat .git/config
  • Setting up Capistrano 2.1 with Git SCM
  • Deploying the App
  • Making a change and re-deploying
  • Working in a new 'testing' branch
  • Switching to main branch, applying a patch, redeploying
  • Switching back to 'testing' branch, continuing to work
  • Merging 'testing' into the main branch, resolving, re-deploying
  • Using gitk
  • Using :deploy_via, :copy and :remote_cache

Setup Files

Here are some setup files I mention in the screencast: Here are most of the commands I had to run to get everything installed on my Debian etch servers I used in this screencast:
  apt-get update
  apt-get install libcurl3 libcurl3-dev libexpat libexpat-dev
  apt-get install ruby1.8-dev rails ri irb rdoc libmysql-ruby mysql-server nginx
             git-core build-essential sudo
  gem install mongrel -y (twice)
  gem install mongrel_cluster -y (twice)
  gem install capistrano

More Info

For more information, I highly recommend: Send any feedback to me at schacon@gmail.com
blog comments powered by Disqus