How to fix npm ERR! git clone git://github.com/user/repo.git failed npm ERR! fatal: repository not found in npm

npmINTERMEDIATEMEDIUMUpdated Dec 7, 2025ยท 229 views

This error occurs when npm attempts to clone a git repository during dependency installation but git cannot locate the repository at the specified URL. This suggests either the URL is wrong, the repository doesn't exist, or you lack permissions.

Quick fix

Fixes npm ERR! git clone git://github.com/user/repo.git failed npm ERR! fatal: repository not found

git clone https://github.com/OWNER/REPO.git
  1. Verify the repository URL format
  2. Verify the repository actually exists
  3. Test authentication with git directly
  4. Fix authentication for private repositories
npm โ€” error
git clone https://github.com/OWNER/REPO.git
npm ERR! git clone git://github.com/user/repo.git failed
npm ERR! fatal: repository not found

What this error means

This error occurs when npm attempts to clone a git repository during dependency installation but git cannot locate the repository at the specified URL. Unlike authentication errors, this suggests either: 1. The URL is wrong (typos, incorrect format) 2. The repository doesn't exist at that location 3. You lack sufficient permissions to see the repository (which git treats as "not found") Important: Git hosting platforms like GitHub intentionally return "not found" for private repositories you can't access, to avoid leaking information about which private repositories exist. This means "repository not found" often actually means "permission denied" for private repos.

Typical symptoms

  • npm install fails with 'fatal: repository not found'
  • Error appears when installing dependencies from git repositories
  • Works on some machines but fails on others
  • CI/CD pipelines fail at dependency installation step
  • Private repositories fail but same URL works with manual git clone

Common causes

  1. Invalid or malformed URL in package.json (typos, incorrect format)
  2. Repository deleted or renamed
  3. Case sensitivity mismatch in repository name
  4. Missing .git extension (some hosts require it)
  5. Incorrect Git protocol (git:// blocked by firewall)
  6. Permission denied appearing as 'Not Found' for security
  7. Wrong SSH key or SSH configuration
  8. Cached invalid credentials preventing authentication

How to fix "npm ERR! git clone git://github.com/user/repo.git failed npm ERR! fatal: repository not found"

1Verify the repository URL format

Check your package.json and verify the git URL is correct:

Valid formats:
- GitHub: https://github.com/OWNER/REPO or git+https://github.com/OWNER/REPO.git
- SSH: git+ssh://git@github.com/OWNER/REPO.git
- Shorthand: github:OWNER/REPO

Invalid formats (remove if present):
- https://github.com/OWNER/REPO/tree/main (branch reference for UI, not git)
- git://github.com/OWNER/REPO (git:// protocol may be blocked)

Check exact capitalization and spelling.

2Verify the repository actually exists

Visit the repository URL in a web browser to confirm:
- The repository exists and hasn't been deleted
- You can access it (may require login for private repos)
- The owner and repository names are spelled correctly

For GitHub: https://github.com/OWNER/REPO

Check the exact capitalization against the URL in your package.json.

3Test authentication with git directly

Try cloning the repository manually:

bash
git clone https://github.com/OWNER/REPO.git

If this succeeds, the issue is npm-specific.
If this fails with "repository not found", it's a git/authentication issue.

For SSH URLs:

bash
ssh -T git@github.com

This should respond with "Hi username! You've successfully authenticated."

4Fix authentication for private repositories

Private repositories require proper authentication:

Option A: Use Personal Access Token (HTTPS)

json
{
  "dependencies": {
    "my-package": "git+https://TOKEN:x-oauth-basic@github.com/OWNER/REPO.git"
  }
}

Option B: Use SSH with Deploy Keys
1. Add an SSH key as a deploy key in repository settings
2. Configure ~/.ssh/config
3. Update package.json:

json
{
  "dependencies": {
    "my-package": "git+ssh://git@github.com/OWNER/REPO.git"
  }
}
5Clear cached credentials

Outdated cached credentials can cause "repository not found" errors:

Windows:
1. Open Control Panel > Credential Manager
2. Find entries for github.com
3. Delete git-related credentials
4. Run npm install again

macOS:
1. Open Keychain Access
2. Search for "github"
3. Delete expired/incorrect credentials

Linux:

bash
git config --global --unset credential.helper
6Handle firewall blocking git:// protocol

If git:// URLs fail but https:// works, configure git to use HTTPS:

bash
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://

Update package.json to use explicit git+https://.

Advanced notes

Authentication vs. Authorization: Git distinguishes between "I can't authenticate you" (403) and "the repository doesn't exist" (404). GitHub returns 404 for private repositories you can't access to avoid leaking information about which private repos exist.

Git Protocol Trade-offs:
- git:// - Fastest, read-only, often blocked by firewalls
- ssh:// - Requires SSH key setup, works in restricted networks
- https:// - Works everywhere, supports token authentication

Repository Case Sensitivity: GitHub treats repository names as case-insensitive in URLs but returns the exact case. Always verify the exact capitalization.

Frequently asked questions

What does "npm ERR! git clone git://github.com/user/repo.git failed npm ERR! fata" mean?
This error occurs when npm attempts to clone a git repository during dependency installation but git cannot locate the repository at the specified URL. Unlike authentication errors, this suggests either: 1. The URL is wrong (typos, incorrect format) 2.
How do I fix "npm ERR! git clone git://github.com/user/repo.git failed npm ERR! fata"?
This error occurs when npm attempts to clone a git repository during dependency installation but git cannot locate the repository at the specified URL. This suggests either the URL is wrong, the repository doesn't exist, or you lack permissions.
What causes "npm ERR! git clone git://github.com/user/repo.git failed npm ERR! fata"?
Invalid or malformed URL in package.json (typos, incorrect format) Repository deleted or renamed Case sensitivity mismatch in repository name
Is the "npm ERR! git clone git://github.com/user/repo.git failed npm ERR! fata" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading