# fatal: No submodule mapping found in .gitmodules for path 'lib'

**Code:** `fatal: No submodule mapping found in .gitmodules for path` · **Category:** Git · **Seen on:** Git

The repo tracks a submodule commit but .gitmodules lacks its entry.

## Meaning

Add the entry back to `.gitmodules` (or remove the gitlink with `git rm --cached lib`). Often caused by a missing/ignored .gitmodules.

## Common causes

- .gitmodules not committed
- Entry deleted accidentally
- Gitlink left after removing submodule

## Quick fix

1. Restore the .gitmodules entry
2. `git rm --cached lib` to drop the gitlink
3. `git submodule add URL lib`

## Detailed fix by platform

### Git

1. 

```bash
git config -f .gitmodules submodule.lib.path lib
git config -f .gitmodules submodule.lib.url https://github.com/org/lib.git
```


## How to diagnose

1. **.gitmodules** — has path?
2. **Gitlink** — in index?
3. **Intent** — keep submodule?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/git/submodule-no-submodule-mapping)
