Skip to content

Instantly share code, notes, and snippets.

@wrought
Last active December 15, 2015 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wrought/5329447 to your computer and use it in GitHub Desktop.
Save wrought/5329447 to your computer and use it in GitHub Desktop.
backup postgres db with --inserts flag so it is easier to git track (instead of multiple snapshots, track snapshots with git)
#!/bin/bash
host="host"
user="pg_user"
port=1000
dbname="dbname"
# the "no-password" flag requires a .pgpass file with a password, to avoid being prompted for a password
pg_dump -h $host -U $user -p $port --no-password --inserts $dbname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment