Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions base/scripts/onyxia-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,14 @@ if command -v git &>/dev/null; then
fi
if [[ -n "$GIT_REPOSITORY" ]]; then
if [[ -n "$GIT_PERSONAL_ACCESS_TOKEN" ]]; then
REPO_DOMAIN=`echo "$GIT_REPOSITORY" | awk -F/ '{print $3}'`
if [ $REPO_DOMAIN = "github.com" ]; then
GIT_REPOSITORY=`echo $GIT_REPOSITORY | sed "s/$REPO_DOMAIN/$GIT_PERSONAL_ACCESS_TOKEN@$REPO_DOMAIN/"`
REPO_DOMAIN=$(echo "$GIT_REPOSITORY" | awk -F/ '{print $3}')
if [ "$REPO_DOMAIN" = "github.com" ]; then
GIT_REPOSITORY=$(echo "$GIT_REPOSITORY" | sed "s|$REPO_DOMAIN|$GIT_PERSONAL_ACCESS_TOKEN@$REPO_DOMAIN|")
GIT_REPOSITORY=$(echo "$GIT_REPOSITORY" | sed "s|$REPO_DOMAIN|$GIT_PERSONAL_ACCESS_TOKEN@$REPO_DOMAIN|")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, It looks like this line is duplicated from above

elif echo "$GIT_REPOSITORY" | grep -qi "bitbucket"; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should check the REPO_DOMAIN here instead of the repository

GIT_REPOSITORY=$(echo "$GIT_REPOSITORY" | sed "s|$REPO_DOMAIN|$GIT_USER_NAME:$GIT_PERSONAL_ACCESS_TOKEN@$REPO_DOMAIN|")
else
GIT_REPOSITORY=`echo $GIT_REPOSITORY | sed "s/$REPO_DOMAIN/oauth2:$GIT_PERSONAL_ACCESS_TOKEN@$REPO_DOMAIN/"`
GIT_REPOSITORY=$(echo "$GIT_REPOSITORY" | sed "s|$REPO_DOMAIN|oauth2:$GIT_PERSONAL_ACCESS_TOKEN@$REPO_DOMAIN|")
fi
fi

Expand Down