Skip to content

Instantly share code, notes, and snippets.

@lstoll
Created January 30, 2009 06:37
Show Gist options
  • Save lstoll/54959 to your computer and use it in GitHub Desktop.
Save lstoll/54959 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ ! $1 ]
then
echo "You must specify the name of the repo to clone"
exit
fi
git clone ssh://dh/~/git/$1.git
#!/bin/bash
ssh dh "cd git && ls" | awk -F "." '{print $1}'
#!/bin/bash
# This script makes a lot of assumptions... like you have a dh ssh config.
if [ $1 ]
then
if [[ "$1" == '--help' || "$1" == '-h' ]]
then
echo "either run from the top dir of the repo and we'll use the directory name for the remote repo"
echo "or specify the name for the repo as the first param"
exit
else
reponame=$1
fi
else
if [ ! -d '.git' ]
then
echo "Must run this from the top directory of the repo, so we can then lazily assume the remote name for the repo"
exit
fi
reponame=$(basename $PWD)
fi
# create the remote repo. Deny non fast forwards
ssh dh "cd ~/git && mkdir $reponame.git && cd $reponame.git && git --bare init && git config receive.denyNonFastforwards"
# add this remote as origin
git remote add origin ssh://dh/~/git/$reponame.git
# push the master branch
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment