跳到主要内容

故障排除

如何调试克隆问题

(以及如何处理类似 fatal: could not read Username for 'https://<url>': No such device or address 的错误消息)

此错误可能有多种原因。如果您使用内部仓库,可能需要启用 WOODPECKER_AUTHENTICATE_PUBLIC_REPOS

WOODPECKER_AUTHENTICATE_PUBLIC_REPOS=true

如果这样做不起作用,请尝试确保容器可以访问您的 Git 服务器。为此,请禁用 Git 检出并让容器"挂起":

skip_clone: true

steps:
build:
image: debian:stable-backports
commands:
- apt update
- apt install -y inetutils-ping wget
- ping -c 4 git.example.com
- wget git.example.com
- sleep 9999999

使用 docker ps 获取容器 ID,并从第一列复制 ID。使用以下命令进入容器:docker exec -it 1234asdf bash(将 1234asdf 替换为 docker ID)。然后尝试使用失败管道中的命令克隆 Git 仓库:

git init
git remote add origin https://git.example.com/username/repo.git
git fetch --no-tags origin +refs/heads/branch:

(将 URL 和分支替换为正确的值,使用您的用户名和密码作为登录凭据)