Skip to content

Instantly share code, notes, and snippets.

@kenzie
Created May 26, 2010 14:52
Show Gist options
  • Save kenzie/414585 to your computer and use it in GitHub Desktop.
Save kenzie/414585 to your computer and use it in GitHub Desktop.
Basic git deploy script
require 'rubygems'
require 'net/ssh'
# VERSION 0.2
# 0.2 – 2010/05/26 : added cleanup (rm deploy)
# 0.1 – 2010/05/21 : initial setup
HOST = "domain.com"
USER = "username"
PASSWORD = nil
PATH = "/var/www/path/to/html"
REMOTE = "origin"
puts "\033[1mAttempting to git push to remote #{REMOTE}...\033[0m"
%x{git push #{REMOTE}}
Net::SSH.start(HOST, USER) do |ssh|
puts "\033[1mAttempting to git pull on #{HOST} in #{PATH}...\033[0m"
ssh.exec "cd #{PATH}; git pull; rm deploy.rb"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment