Skip to content

Instantly share code, notes, and snippets.

@nicerobot
Created July 14, 2012 13:34
Show Gist options
  • Save nicerobot/3111363 to your computer and use it in GitHub Desktop.
Save nicerobot/3111363 to your computer and use it in GitHub Desktop.
Create new server and local repository
#!/bin/sh
# 1. Configure ~/.ssh/config with a "git" host.
# 2. curl https://raw.github.com/gist/3111363/server-config.git.sh | sh
# - step 2 will download this local script here and place the remote script
# Usage: ./local-new.git.sh project-name
[ "${1}" ] || {
echo "Usage: $0 repository-name"
exit 1
}
ssh git "cd git; ./server-new.git ${1}" && {
git clone git:git/${1}.git ${1}
}
#!/bin/sh
ssh git 'mkdir git && cd git && curl -O https://raw.github.com/gist/3111363/server-new.git.sh && chmod +x server-new.git.sh'
[ -x local-new.git.sh ] || { curl -O https://raw.github.com/gist/3111363/local-new.git.sh && chmod +x local-new.git.sh; }
#!/bin/sh
[ "${1}" ] || {
echo "Usage: $0 repository-name"
exit 1
}
[ -d skeleton.git ] || {
mkdir skeleton && {
(
cd skeleton
git init
touch README.md
git add README.md
git commit -am 'init'
)
git clone --bare skeleton skeleton.git
rm -rf skeleton
}
}
git clone --bare skeleton.git ${1}.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment