Skip to content

Instantly share code, notes, and snippets.

function gc2 {
url="$1"
download_path="/YOUR/PATH/"
# Remove protocol and .git, replace : with / for SSH
full_path=$(echo "$url" | sed -E 's#(git@|https?://)##; s#:#/#; s#\.git$##')
go_to_path="${download_path}${full_path}"
# Try to clone, capture output and error
output=$(git clone "$url" "$go_to_path" 2>&1)
clone_status=$?