Created
July 8, 2011 03:09
-
-
Save leonardofaria/1071044 to your computer and use it in GitHub Desktop.
Bash script to create and initialize a git repo on a dreamhost server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on: | |
# http://casperfabricius.com/site/2008/09/21/keeping-git-repositories-on-dreamhost-using-ssh/ | |
# https://gist.github.com/108398 | |
[email protected] | |
GIT_DOMAIN=git_server | |
DH_USER=home/user | |
# set up on the server | |
ssh $DREAMGIT_DOMAIN 'mkdir -p '$GIT_DOMAIN'/'$1'.git && cd '$GIT_DOMAIN'/'$1'.git && git --bare init' | |
# set up locally | |
mkdir $1 | |
cd $1 | |
git init | |
# associate with server | |
git remote add origin ssh://$DREAMGIT_DOMAIN/$DH_USER/$GIT_DOMAIN/$1.git | |
# get some default folder contents | |
echo " | |
.bundle | |
.DS_Store | |
db/*.sqlite3 | |
log/*.log | |
tmp/**/*" > .gitignore | |
echo $1 >> README | |
git add . | |
git commit -m 'Created new repo' | |
git push origin master | |
echo " | |
[branch \"master\"] | |
remote = origin | |
merge = refs/heads/master" >>.git/config | |
echo "Your new git repo '$1' should be all set up at $DREAMGIT_DOMAIN/$GIT_DOMAIN/$1.git" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment