aboutsummaryrefslogtreecommitdiff
path: root/git-shell-commands/new-repo
blob: fa0b26b39729c08b3d3f9d9f645d5ae9ec2dd2b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# this script allows the creation of new repos over ssh on git server
# public repos will get a knot.conf containing the remote
# private repos will just exist on the server
# USAGE:
# ssh git@<host> new-repo 
# - follow the prompts

echo "oh look you are starting a project you won't finish again."
echo "What is your projects name?"
read PROJECT_NAME
if [[ $PROJECT_NAME!=*.git ]]; then
  $PROJECT_NAME="${PROJECT_NAME}.git"
fi
echo "What's the mirror repo remote url?(leave blank if private)"
read REMOTE_URL

git --bare init "${PROJECT_NAME}"

if [[ $REMOTE_URL ]]; then
  touch "${PROJECT_NAME}/knot.conf" 
  echo "${REMOTE_URL}" >> "${PROJECT_NAME}/knot.conf"
fi

echo "git url: ${USER}@${HOSTNAME}:${PROJECT_NAME}"
if [[ $REMOTE_URL ]]; then
  echo "public repo: ${REMOTE_URL}"
fi
#vim: filetype=bash