#!/usr/bin/env bash # AUTHOR: Clemens Schwaighofer # DATE: 2025/6/27 # DESC: create a new basic clone REPOSITORY="$1"; BRANCH="$2"; REMOTE_HOST="$3"; REMOTE="$4"; if [ -n "${REMOTE}" ]; then REMOTE="origin" fi; BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/"; # shellcheck source=init.sh . "${BASE_FOLDER}init.sh"; if [ -z "${REMOTE_HOST}" ]; then echo "Must set a remote host for the repository"; exit; fi; echo "* Validate SSH PEM Key exist and SSH config"; # grep "Host ${REMOTE}" # grep "IdentityFile" in this echo "New clone"; GIT_COMMAND=("${GIT_COMMAND_BASE[@]}" "clone" "-b" "${BRANCH}" "--single-branch" "--depth" "1" "--origin" "${REMOTE}" "${REMOTE_HOST}:${REPOSITORY}" "${GIT_REPOSITORY_FOLDER}${CLONE_BASE}") echo "Command: ${GIT_COMMAND[*]}" # echo ${GIT_COMMAND_BASE} clone -b "${BRANCH}" --single-branch --depth 1 --origin "${REMOTE}" "${REMOTE_HOST}:${REPOSITORY}" "${GIT_REPOSITORY_FOLDER}${CLONE_BASE}"; # __END__