Created
December 11, 2009 18:17
-
-
Save evilstreak/254393 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
function is-git? { | |
git status &> /dev/null | |
[ $? != 128 ] | |
} | |
function git-init-remote { | |
name=$(basename $PWD).git | |
path="~/repos/$name" | |
if is-git?; then | |
if ssh evilstreak.co.uk -t "mkdir $path && cd $path && git --bare init"; then | |
git remote add origin evilstreak.co.uk:$path | |
git push origin master | |
else | |
echo "git repository creation failed" >&2 && return 1 | |
fi | |
else | |
echo "Not a git repository, asshole." >&2 && return 1 | |
fi | |
} | |
git-init-remote |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment