[FAQ] GHCR push returns denied in GitHub Actions even with packages: write
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 86/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- docker, github-actions
- 领域
- devops, documentation
调研方向
阅读 repository 中的 FAQ 条目,并将其中的故障排查步骤和重试示例与链接的 .github/workflows/cd.yml 进行比较。确认措辞区分了观察到的首次 push 失败与通常由权限和命名导致的问题;当答案清晰且示例指向可正常工作的 workflow 时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Course
ai-dev-tools-zoomcamp
Question
Final project CI/CD: my GitHub Actions workflow gets denied when pushing a new image to GHCR, even though it has packages: write and docker login succeeds. How do I fix it?
Answer
Re-run the job, and add a retry to the push. In my project the first push of each brand-new package failed, and the same push succeeded on the re-run, with no change to the workflow.
What the log looked like. The layers upload, then the push fails:
ae51df8ce05a: Pushed
error from registry: denied
denied
I had two images, and each one failed once. The first run failed on the API image. The re-run published it and then failed on the frontend image. The third run published both. Later pushes to the same packages had no problem.
Before assuming that's your issue, check the usual causes of denied:
- The workflow or job has
permissions: packages: write. The default token may be read-only. - The image name uses your own lowercase owner:
ghcr.io/<owner>/<name>. docker/login-actionusespassword: ${{ secrets.GITHUB_TOKEN }}, and the log showsLogin Succeeded!.
If all three are fine and the package doesn't exist yet, retry so a fresh setup doesn't need a manual re-run:
for attempt in 1 2 3; do
docker push --all-tags "$repository" && break
[ "$attempt" = 3 ] && exit 1
sleep 15
done
I don't know the exact cause on GitHub's side. This is what I observed, on a public repository with a user-owned package.
Working example: https://github.com/devotuoma/chamaledger/blob/main/.github/workflows/cd.yml
Checklist
- I have searched existing FAQs and this question is not already answered
- The answer provides accurate, helpful information
- I have included any relevant code examples or links
- 主要语言
- Python
- 星标
- 8
- 派生
- 20
- 平均合并
- 4 天 8 小时
- 30 天内合并 PR
- 28
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DataTalksClub/faq 的其他 Issue
-
[FAQ] How do I use `GridSearchCV` with parallel processing, and how do I fix the scikit-learn parallel-processing warning?可能重新可做 关联的 PR 已关闭且未合并。 未关闭faq-proposal
难度 1/5 1-3 小时 新手友好度 86/100
DataTalksClub/faq#551 · 4 条评论 ·
维护者通常 2 天内回复
-
Fixing ValueError: This solver needs samples of at least 2 classes in Logistic Regression可能已有人在做 @github-actions 于 9 天前认领。 未关闭faq-proposal
难度 2/5 1-3 小时 新手友好度 62/100
DataTalksClub/faq#532 · 2 条评论 ·
维护者通常 2 天内回复
-
[FAQ] Commit ID for Projects可能已有人在做 @github-actions 于 13 天前认领。 未关闭faq-proposal
难度 1/5 1 小时以内 新手友好度 84/100
DataTalksClub/faq#503 · 3 条评论 ·
维护者通常 2 天内回复
-
[FAQ] ImportError: scipy._cyutility does not export expected C function slice_memviewslice when importing sklearn可能重新可做 关联的 PR 已关闭且未合并。 未关闭faq-proposal
难度 1/5 1 小时以内 新手友好度 20/100
DataTalksClub/faq#538 · 2 条评论 ·
维护者通常 2 天内回复
-
[FAQ] : Homework 6 Q3 - my best n_estimators is 150, not 100: check DictVectorizer(sparse=...)可能已有人在做 @github-actions 于 9 天前认领。 未关闭faq-proposal
难度 1/5 1 小时以内 新手友好度 25/100
DataTalksClub/faq#528 · 2 条评论 ·
维护者通常 2 天内回复
查看 DataTalksClub/faq 的全部 Issue
相似的 Issue
-
area: web priority: P1 story
难度 2/5 1-3 小时 新手友好度 76/100
nfiasco/Quant-Time-Machine#151 ·
维护者通常 1 天内回复
-
docs pydanty:is-working
难度 1/5 1-3 小时 新手友好度 85/100
pydantic/pydantic-ai#12892 ·
维护者通常 1 天内回复
-
needs-triage
难度 1/5 1-3 小时 新手友好度 72/100
Azure/azure-sdk-for-python#49886 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
[Core] Deprecated(error=True) raises only on the first call; later calls run the removed API可能已有人在做 @wguo7 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
ray-project/ray#67965 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
btclib-org/btclib#3006 ·
维护者通常 1 天内回复