Clone from public Codeberg repository fails with authentication required

未关闭
#425 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

@cooktheryan 已经在做这个了。

开始于 2026年11月9日。

  • #426 来自 @cooktheryan —— 未关闭

评估

难度
3/5
预计耗时
半天
新手友好度
65/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
git, go
领域
devops

调研方向

Start with the clone path in pkg/engine/fetchit.go, where git.CloneOptions.Auth is always set to githttp.BasicAuth, then check the same pattern in pkg/engine/mirrors.go. Reproduce by cloning the public Codeberg repo with no credentials configured. Done means an anonymous clone of a public repository succeeds, and clones with credentials still send them.

由索引模型根据 Issue 内容生成。

描述

I'm experiencing an issue when Fetchit tries to clone a public repository hosted on Codeberg.

The repository is: https://codeberg.org/dunossauro/obs-pods

Fetchit returns the following error:

podman run --replace --name fetchit   -v fetchit-volume:/opt   -v "$HOME/.fetchit:/opt/mount"   -v "/run/podman/podman.sock:/run/podman/podman.sock"   --security-opt label=disable   quay.io/fetchit/fetchit:latest

initializing fetchit
starting fetchit
2026-11-03T22:05:51.087Z	INFO	engine/fetchit.go:531	git clone https://codeberg.org/dunossauro/obs-pods main --recursive
2026-11-03T22:05:51.831Z	INFO	engine/fetchit.go:563	git clone failed: authentication required: Credentials are incorrect or have expired. Retry your command or see https://codeberg.org/forgejo/forgejo/issues/2809 for more information

My poor investigation (sorry, I don't know much about Go)

I tried to investigate the clone implementation in pkg/engine/fetchit.go.

The current implementation always initializes git.CloneOptions.Auth with githttp.BasicAuth, even when no username or password is configured.

I also created an isolated Go test using the exact same go-git version used by Fetchit: github.com/go-git/go-git/v5 v5.19.2

The following operation succeeds:

git.PlainClone(
    "/tmp/obs-pods-gogit",
    false,
    &git.CloneOptions{
        URL: "https://codeberg.org/dunossauro/obs-pods",
        ReferenceName: plumbing.NewBranchReferenceName("main"),
        SingleBranch: true,
    },
)

Output: CLONE SUCCESS

No authentication is required. I also confirmed that the repository has no .gitmodules file, so submodules are not involved.

Suspected cause

Fetchit unconditionally configures HTTP Basic Authentication, even when credentials are empty.

Could this be causing Codeberg/Forgejo to reject the anonymous clone request?

Would it make sense to configure CloneOptions.Auth only when credentials are actually provided?

The same behavior should also be reviewed in pkg/engine/mirrors.go.

Environment

  • Fetchit image: quay.io/fetchit/fetchit:latest
  • Go dependency: go-git v5.19.2
  • Repository host: Codeberg / Forgejo
  • Repository visibility: Public
  • Authentication: None intended

Really thanks for this amazing project ❤️

主要语言
Go
星标
178
派生
25
平均合并
1 天 2 小时
30 天内合并 PR
2

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

containers/fetchit 的其他 Issue

查看 containers/fetchit 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。