Skip to content

[BUG] GitLab tarball URL format is deprecated - causes TAR_BAD_ARCHIVE on private repos #325

Description

@leocape

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

hosted-git-info generates the old GitLab archive URL format:

This causes TAR_BAD_ARCHIVE: Unrecognized archive format errors when installing any git+https://gitlab.com/ dependency via npm, because npm receives an HTML sign-in page instead of a tarball.

Expected Behavior

The tarball is downloaded, not redirected to the signin html / does not download the signin html

No response

Steps To Reproduce

  1. Have a private GitLab repo as a dependency: "my-pkg": "git+https://gitlab.com/my-group/my-repo.git#branch"
  2. Run npm install
  3. Get TAR_BAD_ARCHIVE: Unrecognized archive format

Old format (what hosted-git-info generates) - broken:
curl -s -o /dev/null -w "%{http_code}" -H "PRIVATE-TOKEN: $TOKEN" "https://gitlab.com/group/repo/repository/archive.tar.gz?ref=main"

Returns: 302 (redirects to /users/sign_in)

New format - works
curl -s -o /dev/null -w "%{http_code}" -H "PRIVATE-TOKEN: $TOKEN" "https://gitlab.com/group/repo/-/archive/main/repo-main.tar.gz"

Returns: 200

Environment

  • npm: (as per node versions below)
  • Node: tried 18, 20, 22, 24
  • OS: tried MacOS, Ubuntu 20, 22
  • platform: tried Local machine (Mac), Gitlab Runner CICD (self hosted on Ubuntu 20)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions