Skip to content

Instantly share code, notes, and snippets.

@envex
Created November 1, 2012 02:52
Show Gist options
  • Save envex/3991349 to your computer and use it in GitHub Desktop.
Save envex/3991349 to your computer and use it in GitHub Desktop.
Setup a new project for Git pushes to an FTP server
#!/bin/bash
# Creates a new project folder on the server,
# creates a new git repo, adds our post-receive
# hook and add a value to the config
cd ~/
echo "
What's the new projects path?"
read new_project_folder
echo "
Going to $new_project_folder"
cd ~/$new_project_folder
# Fresh git
git init
# Setup the new hook and fix the permissions
POST_RECEIVE=`curl https://raw.github.com/gist/2926367/b2be776f73a486ada91c07e0df9c34b0be92925a/post-receive -o ".git/hooks/post-receive"`
chmod 777 .git/hooks/post-receive
# Add the config to the config
ADD_TO_CONFIG="
[receive]
denyCurrentBranch = ignore";
echo $ADD_TO_CONFIG >> '.git/config'
# Finishing touches
echo "
Project Setup!
Don't forget to add this remote
git remote add ftp ssh://envexlabs@envexlabs.com/~/$new_project_folder"
# Goodbye
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment