nuxt / nuxt/content

defineGitSource

Open Beginner friendly
#3,818 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.7k
Forks
746
Avg merge
1d 16h
Merged PRs (30d)
3

Description

Environment
Operating system Windows 10.0.26200
CPU 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 cores)
Node.js version v24.15.0
nuxt/cli version 3.36.1
Package manager npm@11.12.1
Nuxt version 4.4.8
Nitro version 2.13.4
Builder vite@7.3.6
Config compatibilityDate, content, devtools, modules
Modules @nuxt/content@3.15.0
Version

3.15.0

Reproduction

I think the issue is obvious and the below description is enough to understand the problem and solution.

Description

Hello,

When I define a collection source where the repository property is a url string that ends in .git like so:

source: {
    repository: 'https://git.domain.tld/repo.git',
    include: '**/*.json',
},

npm run dev throws a ERROR HTTP Error: 404 Not Found. I think it is because you don't add back the .git suffix when transforming the repository property from a string into an object (line 65-68 below):

https://github.com/nuxt/content/blob/d8fed0c3ddbcad5805772e1ef8da9fbe841e772e/src/utils/source.ts#L56-L71

As a workaround, I can define my collection source repository as an object instead of a string like so:

source: {
    repository: {
        url: 'https://git.domain.tld/repo.git',
        branch: 'main',
    },
},
Additional context

No response

Logs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/utils/source.ts lines 56-71 and reproduce the issue using the provided string repository configuration with npm run dev. Done means a repository URL ending in .git remains valid after string-to-object transformation and no 404 occurs; the object-form workaround should continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, typescript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.