Clone private bitbucket repository

I’ve read a bunch of guides about cloning from private repo (this one for example) and still could not understand how it’s supposed to work:

 commands:
    - mkdir /root/.ssh && echo "$SSH_KEY" > /root/.ssh/id_rsa && chmod 0600 /root/.ssh/id_rsa

This step makes no sense for me since I have to pull repository before running commands, so my build fails on cloning stage. Probably this guide is outdated?

This step makes no sense for me since I have to pull repository before running commands, so my build fails on cloning stage. Probably this guide is outdated?

Drone automatically clones your repository. No additional steps or configuration is required. The example you pasted above is for cloning additional repositories.

It looks like my agent failed to clone private repository:

+ git init
Initialized empty Git repository in /drone/src/bitbucket.org/org_name/repo_name/.git/
+ git remote add origin https://bitbucket.org/org_name/repo_name.git
+ git fetch --no-tags origin +refs/heads/feature/ci-build:
fatal: unable to access 'https://bitbucket.org/org_name/repo_name.git/': Could not resolve host: bitbucket.org
exit status 128

I tried to curl bitbucket.org from agent and it’s reachable:

> docker exec drone_ci_drone-agent-1_1 apk --no-cache add curl && curl -I https://bitbucket.org |grep HTTP
HTTP/1.1 200 OK

How can I debug this issue?

Please search for “Could not resolve host” in the issue tracker.