mkrepo 568 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. REPO_BASE_PATH=""
  3. URL_PART_BEFORE_REPONAME=""
  4. URL_PART_AFTER_REPONAME=""
  5. [ -z "$1" ] && echo "Error: please give a repository name as argument" && exit 1
  6. [ -d "$REPO_BASE_PATH/$1.git" ] && echo "Error: repository '$1' already exists" && exit 1
  7. error_exit() {
  8. "Error: couldn't create the repository '$1'"
  9. exit 1
  10. }
  11. mkdir -v "$REPO_BASE_PATH/$1.git" || exit 1
  12. cd "$REPO_BASE_PATH/$1.git" || exit 1
  13. git init --bare || exit 1
  14. cd - || exit 1
  15. echo "the repo should be available at:"
  16. echo "${URL_PART_BEFORE_REPONAME}${1}.git${URL_PART_AFTER_REPONAME}"