为什么 Drone 无法读取我的用户名?

Why is Drone failing to read my username?

我正在设置一个与自托管 Gogs 服务器集成的自托管 Drone CI 服务器。

我已经建立了一个具有以下结构的测试存储库:

test/
 |
 *- add.go
 *- add_test.go
 *- .drone.yml

我的.drone.yml文件内容如下:

image: mischief/docker-golang
env:
    - GOPATH=/var/cache/drone
script:
    - go build
    - go test -v

Drone 使用以下环境变量启动(通过 docker run-e 标志传递,因为 Drone 和 Gogs 都是 运行 容器化的。

"DRONE_GOGS_SKIP_VERIFY=true"
"DRONE_GOGS_URL=http://gogs.sentimens.duckdns.org"
"DRONE_GOGS_SECRET=[redacted]"
"DRONE_GOGS_OPEN=true"

推送到新存储库时,构建被触发,但失败并显示以下输出:

$ git clone --depth=50 --recursive --branch=master http://gogs.sentimens.duckdns.org/drone/test.git /var/cache/drone/src/gogs.sentimens.duckdns.org/drone/test
Cloning into '/var/cache/drone/src/gogs.sentimens.duckdns.org/drone/test'...
fatal: could not read Username for 'http://gogs.sentimens.duckdns.org': No such device or address

这是怎么回事?我需要在 yaml 文件中指定凭据吗?

检查您的 Git 版本。在 Gogs issue 717

中看到了该错误消息

Probably because git 1.7 does not have the same format for error messages.

Can you try to clone in command line without username or password, to see if you got the same error message like git clone: fatal: could not read Username for 'http://xxxx.xxx': No such device or address?

存储库必须 public: https://github.com/drone/drone/issues/860