Created
July 31, 2008 16:03
-
-
Save subtleGradient/3464 to your computer and use it in GitHub Desktop.
Create a new Git repo.<br /> Can be executed remotely via ssh.<br /> EG: <code>ssh myhost.com 'newgit "myrepo.git"'</code>
This file contains 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
# ~/.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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment