8000 Enable cloning via ssh by slinstaedt · Pull Request #24 · drone/drone-git · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Enable cloning via ssh #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
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

# DRONE_GIT_SSH_URL=git@github.com:slinstaedt/drone-plugin-base.git
# DRONE_GIT_SSH_URL=ssh://git@stash.integra.local: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
0