Search code examples
gitdockergit-worktree

Docker with git worktree: fatal: Not a git repository


I have projects folder that is in my /home/my/ folder on host and mounted at /home/user/projects at docker container. In this folder there is git repo /home/user/projects/repo with additional worktree: /home/user/projects/repo-b (added by git worktree add)

When I am tring to do any git command in /home/user/projects/repo-b I recive

fatal: Not a git repository: /home/my/projects/repo/.git/worktrees/repo-b/

I have tried to create link at home: me -> user without any progress.


Solution

  • Ok, problem was simple and stupid. My git in docker container was old enough not to support worktree functionality. So updating git and creating simlink to user folder solve it.