Summary
When using JFrog Artifactory as a remote repository proxy for GitHub, downloading archive (zip) files from private repositories (including GitHub EMU accounts) fails because GitHub uses a redirect-based download flow that Artifactory cannot follow with authentication.
Problem
GitHub serves archive downloads differently for private vs public repos:
- Public repos:
https://github.com/{owner}/{repo}/archive/refs/heads/{ref}.zip serves the zip directly — Artifactory can proxy this without issues.
- Private repos: The same URL returns a 302 redirect to
https://codeload.github.com/{owner}/{repo}/legacy.zip/refs/heads/{ref}?token=<temporary-token>. Artifactory's remote repository cannot follow this cross-host redirect with proper authentication, resulting in a 404.
Workaround
The workaround is to configure the Artifactory remote repository's upstream URL to point to https://codeload.github.com/ instead of https://github.com/. The codeload endpoint serves the zip directly with token authentication (no redirect), which Artifactory can proxy correctly.
However, the URL pattern changes:
- github.com style:
/{owner}/{repo}/archive/refs/heads/{ref}.zip
- codeload.github.com style:
/{owner}/{repo}/zip/refs/heads/{ref}
This means APM's build_artifactory_archive_url() in utils/github_host.py currently only generates github.com-style and gitlab-style archive URLs. It does not generate codeload.github.com-style URLs, so Artifactory remote repos configured with the codeload workaround won't match APM's expected URL patterns.
Impact
This affects any organization using:
- GitHub EMU (Enterprise Managed Users) accounts with private repositories
- JFrog Artifactory as a registry proxy for GitHub
- APM for package management
Suggestion
Consider adding support for the codeload.github.com URL pattern in build_artifactory_archive_url():
# codeload.github.com style: /{owner}/{repo}/zip/refs/heads/{ref}
f"{base}/zip/refs/heads/{ref}",
# codeload.github.com tags fallback
f"{base}/zip/refs/tags/{ref}",
Additionally, APM could detect whether an Artifactory remote repo proxies github.com vs codeload.github.com and adjust the URL pattern accordingly.
Additional Artifactory Configuration Notes
For others hitting this issue, the Artifactory remote repository also requires:
- Token authentication enabled with a GitHub PAT that has repo access
- Include patterns set to allow the
{owner}/{repo}/** path
- Upstream URL set to
https://codeload.github.com/ for private repos
🤖 Generated with Claude Code
Summary
When using JFrog Artifactory as a remote repository proxy for GitHub, downloading archive (zip) files from private repositories (including GitHub EMU accounts) fails because GitHub uses a redirect-based download flow that Artifactory cannot follow with authentication.
Problem
GitHub serves archive downloads differently for private vs public repos:
https://github.com/{owner}/{repo}/archive/refs/heads/{ref}.zipserves the zip directly — Artifactory can proxy this without issues.https://codeload.github.com/{owner}/{repo}/legacy.zip/refs/heads/{ref}?token=<temporary-token>. Artifactory's remote repository cannot follow this cross-host redirect with proper authentication, resulting in a 404.Workaround
The workaround is to configure the Artifactory remote repository's upstream URL to point to
https://codeload.github.com/instead ofhttps://github.com/. The codeload endpoint serves the zip directly with token authentication (no redirect), which Artifactory can proxy correctly.However, the URL pattern changes:
/{owner}/{repo}/archive/refs/heads/{ref}.zip/{owner}/{repo}/zip/refs/heads/{ref}This means APM's
build_artifactory_archive_url()inutils/github_host.pycurrently only generatesgithub.com-style andgitlab-style archive URLs. It does not generatecodeload.github.com-style URLs, so Artifactory remote repos configured with the codeload workaround won't match APM's expected URL patterns.Impact
This affects any organization using:
Suggestion
Consider adding support for the
codeload.github.comURL pattern inbuild_artifactory_archive_url():Additionally, APM could detect whether an Artifactory remote repo proxies
github.comvscodeload.github.comand adjust the URL pattern accordingly.Additional Artifactory Configuration Notes
For others hitting this issue, the Artifactory remote repository also requires:
{owner}/{repo}/**pathhttps://codeload.github.com/for private repos🤖 Generated with Claude Code