Dune
Dune

Reputation: 704

git cached file is outside repository

Out of the blue, git started to track ~/.config/chromium directory. My repository's path looks something like this: ~/app/my-project. My guess is that Chromium directory was added to a repo because I launched Chromium with disabled web security flag from the my-project directory. I tried to remove it with git rm --cached ~/.config, but then I get the error

fatal: /home/user/.config: '/home/user/.config' is outside repository

Any ideas how can it track it and at the same time claim it's outside the repository? And how can I fix this? I'd rather avoid deleting my ~/.config directory.

git status:

src/pages/Page.js
~/.config/chromium/Default/Cache/xyz
~/.config/chromium/Default/Cache/abc
~/.config/chromium/Local State

Upvotes: 5

Views: 822

Answers (1)

Ferrybig
Ferrybig

Reputation: 18844

You accidentally created a file called ~ inside your git project, and are now confused by the fact that you think the ~ refers to your home directory.

To delete this file, just quote the path:

git rm --cached "~/.config"

Upvotes: 5

Related Questions