iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🌊

How to Fix Git includeIf Not Working

に公開

Conclusion

  • Run git init in the parent directory

Context

https://zenn.dev/yyykms123/articles/2023-12-02-auto-switch-git-user-per-repo
https://kakakakakku.hatenablog.com/entry/2019/11/06/114926
Referring to articles such as the ones above,

[user]
  [includeIf "gitdir:~/private/"]
    path = ~/.gitconfig-private
  [includeIf "gitdir:~/works/"]
    path = ~/.gitconfig-works

even if you configure it separately like this,

git config user.name //no response

no response is returned.

Solution

  • In the case of gitdir:~/works/, move to the works folder and run git init there.
    • Running git init makes includeIf start functioning.

Reference

https://stackoverflow.com/questions/64843104/why-gitconfig-includeif-does-not-work

Finally

I wasted three whole days on this.

Discussion