From 6b89adc168201bb2e3a70fa439c5b15da1878e9d Mon Sep 17 00:00:00 2001 From: HonQi Date: Thu, 6 May 2021 16:28:27 +0800 Subject: [PATCH] Fix could not read Username for 'https://github.com' error Push to the repo of another account (such as an organization) may trigger this error. Clearly indicate the account name to avoid --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index e41a175..4e46c3e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -29,7 +29,7 @@ echo "Cloning destination git repository" # Setup git git config --global user.email "$USER_EMAIL" git config --global user.name "$USER_NAME" -git clone --single-branch --branch "$TARGET_BRANCH" "https://$API_TOKEN_GITHUB@github.com/$DESTINATION_REPOSITORY_USERNAME/$DESTINATION_REPOSITORY_NAME.git" "$CLONE_DIR" +git clone --single-branch --branch "$TARGET_BRANCH" "https://$USER_NAME:$API_TOKEN_GITHUB@github.com/$DESTINATION_REPOSITORY_USERNAME/$DESTINATION_REPOSITORY_NAME.git" "$CLONE_DIR" ls -la "$CLONE_DIR" TARGET_DIR=$(mktemp -d) @@ -75,4 +75,4 @@ git diff-index --quiet HEAD || git commit --message "$COMMIT_MESSAGE" echo "git push origin:" # --set-upstream: sets de branch when pushing to a branch that does not exist -git push origin --set-upstream "$TARGET_BRANCH" +git push "https://$USER_NAME:$API_TOKEN_GITHUB@github.com/$DESTINATION_REPOSITORY_USERNAME/$DESTINATION_REPOSITORY_NAME.git" --set-upstream "$TARGET_BRANCH"