fix fatal: --local can only be used inside a git repository error


Git - fatal error - local can only be used inside a git repo
% git config --list --local
fatal: --local can only be used inside a git repository

If you are trying to use --local option along with a git command like config, you will get a fatal error saying local can only be used inside a git repository when you are not inside any git managed repo.

The option --local is associated with a repo that is local and hence you should be inside one of them.

Fix:

Navigate to the directory where you have your code in git and run the command again!

% git config --list --local

core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=https://xxxx:xxxx@github.com/xxxx/repo.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.main.remote=origin
branch.main.merge=refs/heads/main


















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap