This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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=$? |