updated git_remotes_set_multi_origin.sh

pull/2/head
Hari Sekhon 4 years ago
parent ac38cf64b2
commit f2fdc85a1b

@ -66,10 +66,10 @@ add_origin_url(){
if [ -n "$url" ]; then
echo "copied existing remote url for $name as is including any access tokens to named remote $name"
else
url="$(git remote -v | awk '{print $2}' | grep -Ei 'bitbucket.org|github.com|gitlab.com' | head -n 1 | perl -pe "s/^(\\w+:\\/\\/)[^\\/]+/\$1$domain/")"
echo "inferring $name URL to be $url"
# don't put this below and it'd print your access token to screen from existing remote
echo "adding additional origin remote for $name with url $url"
url="$(git remote -v | awk '{print $2}' | grep -Ei 'bitbucket.org|github.com|gitlab.com' | head -n 1 | perl -pe "s/(ssh:\\/\\/(\\w+@)?|https?:\\/\\/|\\w+@|).*(bitbucket.org|github.com|gitlab.com)/\$1bitbucket.org/")"
# don't put the full url below as it'd print your access token to screen from existing remote
echo "inferring $name URL to be ${url##*@}"
echo "adding additional origin remote for $name with url ${url##*@}"
fi
set -o pipefail
# --push is willing to add duplicates, prefer error out (should never happen as we check for existing remote url)

Loading…
Cancel
Save