From 12286375b6d5b22d84c9ff2f15787feeb587eca8 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Thu, 13 Dec 2018 17:41:30 +0000 Subject: [PATCH] Don't append token if already pass is used --- docs/src/main/asciidoc/ghpages.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/main/asciidoc/ghpages.sh b/docs/src/main/asciidoc/ghpages.sh index 9ee39156..927084d1 100755 --- a/docs/src/main/asciidoc/ghpages.sh +++ b/docs/src/main/asciidoc/ghpages.sh @@ -34,10 +34,10 @@ function set_default_props() { # Adds the oauth token if present to the remote url function add_oauth_token_to_remote_url() { - if [[ "${RELEASER_GIT_OAUTH_TOKEN}" != "" ]]; then + remote=`git config remote.origin.url | sed -e 's/^git:/https:/'` + echo "Current remote [${remote}]" + if [[ "${RELEASER_GIT_OAUTH_TOKEN}" != "" && ${remote} != *"@"* ]]; then echo "OAuth token found. Will reuse it to push the code" - remote=`git config remote.origin.url | sed -e 's/^git:/https:/'` - echo "Current remote [${remote}]" withToken=${remote/https:\/\//https://${RELEASER_GIT_OAUTH_TOKEN}@} git remote set-url --push origin "${withToken}" else