Skip to content

Instantly share code, notes, and snippets.

@envex
Created November 1, 2012 02:52
Show Gist options
  • Select an option

  • Save envex/3991349 to your computer and use it in GitHub Desktop.

Select an option

Save envex/3991349 to your computer and use it in GitHub Desktop.

Revisions

  1. envex created this gist Nov 1, 2012.
    40 changes: 40 additions & 0 deletions setup_project.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    #!/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