Can't clone private gogs repository in 1.0.0-rc.4: No such device or address


Hello! I’ve been wanting to upgrade to 1.0.0-rc.4 and tried to change everything accordingly like adding DRONE_GIT_USERNAME and DRONE_GIT_PASSWORD with a set of credentials I created for drone in Gogs and toggling DRONE_GIT_ALWAYS_AUTH=true. I’m still getting this however:

Initialized empty Git repository in /drone/src/.git/
+ git fetch origin +refs/heads/master:
fatal: could not read Username for '': No such device or address 

Maybe it’s something related to using HTTPS instead of SSH, which I’m avoiding since Gogs recommends using HTTPS when using its docker image.

Previously, I used drone 0.6.x, and it did work, but I’m not looking forward into downgrading.

I looked into the sqlite database and saw that the repository wasn’t marked as private, so I did it manually (updating the row to have repo_private = 1 and repo_visilibity = private) but still no luck. I may be missing some environment variable, I currently have these set:


I’m also running it on single-machine, I don’t know if running a drone-runner instead would work.

Ah, and gogs is 0.11.79, I updated it to the latest, just in case.


Have you searched the existing threads for this error?


Yes, I have, this was probably the most helpful: Another 'could not read username' when cloning question: Gogs/Drone, and indeed, the repository was marked as public when it should’ve been marked as private.

However, some things have changed especially on the environment variables front, and I’m afraid some of it no longer applies (like the DRONE_GOGS_PRIVATE_MODE doesn’t seem to exist anymore for example).


Private mode was deprecated in favor of DRONE_GIT_ALWAYS_AUTH=true

When always auth is true it will instruct Drone to always clone the repository with credentials, regardless of whether or not the repository is private.


Very interesting. I have that toggled in my environment variables:

But it seems like it doesn’t even attempt to login using my provided credentials DRONE_GIT_USERNAME and DRONE_GIT_PASSWORD in Gogs (hence this error). I’m thinking that what causes this problem is my single machine setup :confused: .

Update: The same happens if I have one agent, so unrelated I guess.


could not read Username for ‘’: No such device or address

Please read this Stackoverflow post:

You will notice that Git will return this error under a variety of circumstances, which may not have anything to do with the actual username or password.

It is more likely that Drone simply cannot reach your Gogs server because you are using custom Docker networks and Docker internal DNS, and the clone container is running on a completely separate Docker network.

You should be able to test all of this manually:

kind: pipeline
name: default

  disable: true

- name: custom_clone
  image: docker:git
  - git clone


And case closed, looks like gogs didn’t set the password correctly for the account I created. If someone else wants to debug this, I recommend setting up your .drone.yml like this:

  disable: true

  - name: clone
    image: docker:git
      - echo $DRONE_REPO_PRIVATE
      - cat /root/.netrc
      - git clone $DRONE_GIT_HTTP_URL


Yea, the error message is quite worthless, but thanks for the help anyway!


How could I handle this circumstance?Change Docker networks?