diff --git a/.config/zsh/autoload/git/git-https-and-ssh b/.config/zsh/autoload/git/git-https-and-ssh index e16b94c..6cc5593 100755 --- a/.config/zsh/autoload/git/git-https-and-ssh +++ b/.config/zsh/autoload/git/git-https-and-ssh @@ -9,12 +9,12 @@ remote="${1:-origin}" url="$($GIT remote get-url "$remote")" if [ "${url##https://}" = "$url" ]; then - https_url="https://${url##*@}" - https_url="${https_url%%:*}/${https_url#*:}" + https_url="${url##*@}" + https_url="https://${https_url/:/\/}" $GIT remote set-url "$remote" "$https_url" $GIT remote set-url --push "$remote" "$url" else - ssh_url="git@${url#https://}" - ssh_url="${ssh_url%%/*}:${ssh_url#*/}" + ssh_url="${url#https://}" + ssh_url="git@${ssh_url/\//:}" $GIT remote set-url --push "$remote" "$ssh_url" fi