Skip to content

Instantly share code, notes, and snippets.

@peterc
Created September 30, 2009 15:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterc/198184 to your computer and use it in GitHub Desktop.
Save peterc/198184 to your computer and use it in GitHub Desktop.
Create and sync a new git repository on Dreamhost
# Create a new git repository on Dreamhost
# Function tweaked from that found at http://craigjolicoeur.com/blog/hosting-git-repositories-on-dreamhost
#
# Just add the code below to your .bashrc.
# Usage:
# newgit some-repo.git
#
# Then locally:
#
# git push --all ssh://$MACHINE/home/$USER/git/my-new-repos.git
# git remote add origin ssh://$MACHINE/home/$USER/git/my-new-repos.git
# git config branch.master.remote origin
# git config branch.master.merge refs/heads/master
# git fetch
# git merge master
newgit()
{
if [ -z $1 ]; then
echo "usage: $FUNCNAME project-name.git"
else
gitdir="/home/$USER/git/$1"
mkdir $gitdir
pushd $gitdir
git --bare init
git --bare update-server-info
chmod a+x hooks/post-update
touch git-daemon-export-ok
popd
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment