简体   繁体   中英

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

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM