You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
589 B
Bash
35 lines
589 B
Bash
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
remote="git.pi"
|
|
|
|
|
|
cmd=${1:-""}
|
|
|
|
if [ "$cmd" == "init" ]; then
|
|
name="$2"
|
|
|
|
if [ ! -d "$name" ]; then
|
|
mkdir $name
|
|
fi;
|
|
|
|
cd $name
|
|
ssh git@git.pi "./create-repo.sh $name"
|
|
|
|
if [ ! -d ".git" ]; then
|
|
git init
|
|
fi;
|
|
git remote add local "git@$remote:$name.git"
|
|
elif [ "$cmd" == "clone" ]; then
|
|
name="$2"
|
|
git clone "git@$remote:$name.git" $name
|
|
else
|
|
echo "usage: gitlocal (init|clone) repository
|
|
|
|
remote: $remote
|
|
|
|
init: initialize repository on the remote server, then create a local folder linked to the remote
|
|
clone: clone a git repository from the remote";
|
|
fi;
|