ryanwold.net

A civic-minded citizen seeking the singularity

Back to Entries

Pushing to Dreamhost using Git

release
Date: 2013-12-01
Tags: dreamhost webhosting

I've been using Dreamhost.com for several years, hosting a few sites.

I've since used Heroku, and I've grown accustomed to being able to deploy code using Git. git push heroku master became a convenience I rely upon.

I wanted to be able to push to Dreamhost using Git. I was able to accomplish it by 1) creating a folder to push to, and 2) modifying the hooks/post-receive file in the .git folder on my Dreamhost account to deploy the site after pushing.

Create a folder to push to

Create a place to push your Git repo to in Dreamhost. For example, I created the folder ryanwold.com.git for the website ryanwold.com.

// on a Dreamhost VPS server

ryanwold.com             # where the Rails app lives
ryanwold.com.git        # the Git destination to push to

Modify hooks/post-receive to deploy after being pushed to

// in hooks/post-receive file, add:

#!/bin/sh
git --work-tree=/home/username/site.com --git-dir=/home/username/site.com.git checkout -f

cd /home/username/site.com
bundle install
touch tmp/restart.txt

By Ryan Wold · © 2013–2026 Ryan Wold

Licensed CC BY-NC 4.0. AI training requires a license — machine-readable terms.

Enjoyed this? — any BSV wallet, HandCash, or plain old dollars.

Leave a tip

Tips go directly to a Bitcoin SV address I control — peer to peer, no platform in between. A few thousand satoshis is a fraction of a cent; it's the gesture that counts.

From any BSV wallet

Scan the QR code with your wallet's camera, or copy the address.

177DwUfSTW8RkFBJzYYcgr1YB8ngbhTYAc

With HandCash or any paymail wallet

Paymail is an email-style address for Bitcoin wallets. Send any amount to afomi@handcash.io

First time using Bitcoin? Yours Wallet is an open-source browser extension wallet, and HandCash is an easy mobile wallet — either takes a minute to set up.

Prefer regular money? Support via OpenCollective.