Created
October 6, 2016 16:48
-
-
Save joelpurra/fc703795653c82764858b42f6cc3fff8 to your computer and use it in GitHub Desktop.
Revisions
-
Eike Kettner revised this gist
Mar 26, 2012 . 1 changed file with 4 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,6 @@ # create a new empty remote repository. # # Usage: git-create <remote-url> # if [ -z "$1" ] then @@ -18,7 +17,7 @@ HOST=`echo $1 | tr ':' ' ' | cut -d' ' -f1` REPO=`echo $1 | tr ':' ' ' | cut -d' ' -f2` #append .git, if not already if [ ! `echo $REPO | grep -e '.git$'` ] then REPO=$REPO.git fi @@ -32,8 +31,8 @@ then fi REMOTE_CMD="mkdir -p $REPO && git init --bare $REPO" ssh $HOST $REMOTE_CMD if [ $? -eq 0 ] then echo "Add content by pushing to the repository:" @@ -43,4 +42,4 @@ then echo else echo "Creating repository failed." fi -
Eike Kettner created this gist
Mar 26, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ #!/bin/bash # # create a new empty remote repository. # # Usage: git-create <remote-url> # works only with simple urls, not ssh://user@remote:port/path/to/repo # if [ -z "$1" ] then echo "Usage: $0 <remote-url>" echo exit 1 fi #parse url in host and repository path HOST=`echo $1 | tr ':' ' ' | cut -d' ' -f1` REPO=`echo $1 | tr ':' ' ' | cut -d' ' -f2` #append .git, if not already if [ ! `echo $PATH | grep -e '.git$'` ] then REPO=$REPO.git fi echo "Create Repository $REPO at $HOST" if [ "$2" == "-i" ] then echo -n "? (y/n) " read r if [ $r == "n" ]; then exit 0; fi fi REMOTE_CMD="mkdir -p $PATH && git init --bare $PATH" ssh $HOST '$REMOTE_CMD' if [ $? -eq 0 ] then echo "Add content by pushing to the repository:" echo echo "git remote add origin $HOST:$REPO" echo "git push -u origin master" echo else echo "Creating repository failed." fi