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
14 changes: 12 additions & 2 deletions posix/clone
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,22 @@ fi

if [[ ! -z "${SSH_KEY}" ]]; then
mkdir /root/.ssh
echo -n "$SSH_KEY" > /root/.ssh/id_rsa
printf "${SSH_KEY}" > /root/.ssh/id_rsa
chmod 600 /root/.ssh/id_rsa

touch /root/.ssh/known_hosts
chmod 600 /root/.ssh/known_hosts
ssh-keyscan -H ${DRONE_NETRC_MACHINE} > /etc/ssh/ssh_known_hosts 2> /dev/null

# [email protected]:slinstaedt/drone-plugin-base.git
# DRONE_GIT_SSH_URL=ssh://[email protected]:7999/eproc/eproc-api.git
HOST=$(echo $DRONE_GIT_SSH_URL | sed 's/.*[\/@]\(.*\):.*/\1/')
PORT=$(echo $DRONE_GIT_SSH_URL | sed 's/.*:\(\d*\)\/.*/\1/')
if [[ "$PORT" = "$DRONE_GIT_SSH_URL" ]]; then
ssh-keyscan $HOST > /root/.ssh/known_hosts 2> /dev/null
else
ssh-keyscan -p $PORT $HOST > /root/.ssh/known_hosts 2> /dev/null
fi
export DRONE_REMOTE_URL="$DRONE_GIT_SSH_URL"
fi

# configure git global behavior and parameters via the
Expand Down