Problems cloning with Gitea

I wanted to address a common error when attempting to clone a repository from Gitea, when Drone and Gitea are running on the same machine (usually with Docker compose). These errors may manifest as one of the following:

Fatal: could not read Username for
Fatal: unable to access

First, we should clear up some misconceptions:

  1. Drone does not clone your code inside the agent or runner container. The fact that the agent or runner or server can communicate with Gitea is irrelevant.
  2. The clone container is attached to a user-defined network. The fact that you can clone code inside a Docker container is irrelevant because that container is probably attached to the bridge network.

In order for the clone container to communicate with Gitea you probably need to attach the Gitea network to the clone container. You can attach additional networks to all pipeline containers using this runner configuration parameter:

DRONE_RUNNER_NETWORKS=<name>

Also note that Drone uses the clone url that is returned from the Gitea API. You may need to modify your Gitea configuration so the clone url matches the hostname of your user-defined network [1].

[server]
ROOT_URL=http://<name>:<port>

[1] [Solved]Unable to access repository but I can clone inside the docker drone

1 Like