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:
- 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.
- 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:
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 .