Articles

Remotely Create a New Git Repo

# ~/.bashrc: executed by bash(1) for non-login shells.
export PATH="$HOME/bin:$HOME/lib/bin:$PATH"
export LC_CTYPE=en_US.UTF-8
# Original "newgit" by CRAIG P JOLICOEUR
# Found at
# http://autopragmatic.com/2008/01/26/hosting-a-git-repository-on-dreamhost/
# http://craigjolicoeur.com/2008/04/hosting-git-repositories-on-dreamhost/
newgit()
{
if [ -z $1 ]; then
echo "usage: $FUNCNAME project-name.git"
else
gitdir="$HOME/Projects/git/$1"
mkdir -p $gitdir
pushd $gitdir
git --bare init
git --bare update-server-info
chmod a+x hooks/post-update
touch git-daemon-export-ok
chmod -R o-r ./
popd
echo "ssh://$USER@subtlegradient.com$gitdir"
fi
}
stage()
{
if [ -z $1 ]; then
echo "usage: $FUNCNAME project-name"
else
gitdir="$HOME/Sites/projects.subtlegradient.com/$1"
mkdir -p $gitdir
pushd $gitdir
git init
git update-server-info
cp "$HOME/lib/git-post-update-stage" "$gitdir/.git/hooks/post-update"
chmod a+x "$gitdir/.git/hooks/post-update"
chmod -R o-r .git/
popd
echo "ssh://$USER@subtlegradient.com$gitdir"
fi
}
view raw bashrc.sh hosted with ❤ by GitHub
This is also partly a trial of the https://gist.github.com embedding.
Thomas Aylott Polaroid

Thomas Aylott / subtleGradient