Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

GitRepository fails to clone from public repo if secretRef is specified without HTTP creds

Đang mở
#880 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
git, go, kubernetes
Lĩnh vực
devops

Hướng nghiên cứu

Bắt đầu trong pkg/git/options.go, quanh các dòng 144-146, và tái hiện vấn đề với GitRepository được cung cấp cùng một manifest Secret trống. Theo dõi cách secretRef ảnh hưởng đến việc truyền tải và xác thực; hoàn tất khi một repository công khai được clone thành công với một Secret được tham chiếu nhưng trống, đồng thời thông tin xác thực vẫn hoạt động עבור các repository riêng tư.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

When trying to pull from a publicly accessible repo, if the .spec.secretRef.name is specified but the secret itself doesn't contain a username/password, the GitRepository will always fail with failed to checkout and determine revision: unable to clone 'https://github.com/fluxcd/source-controller.git': authentication required.

---
apiVersion: v1
kind: Secret
metadata:
  name: git-creds
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: default
secrets:
- name: git
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
  name: gitrepo
spec:
  secretRef:
    name: git-creds
  url: https://github.com/fluxcd/source-controller.git
  ref:
    branch: main
  interval: 1m

Our use case is that we have a SSH key and need to template out a bunch of GitRepositories, some of which are private. So instead of adding logic to conditionally template in the SSH secret, we specify the secretRef on all of the GitRepositories with the expectation that the secret is simply ignored for public repos.

I think this is caused by the controller defaulting to assuming ssh transport (and using git as the username) if the secret is specified but no username is found: https://github.com/fluxcd/source-controller/blob/20b26f235e11a9eb6e0784f2598aeffa63a81606/pkg/git/options.go#L144-L146

Ngôn ngữ chính
Go
Star
283
Fork
258
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
15

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của fluxcd/source-controller

Tất cả issue của fluxcd/source-controller

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.