I have a repository (let's say repo in ~/repo) and a container, based on amd64/ubuntu:20.04 with mounted repo. Outside the container I created a branch of my repo outside:
git worktree add ../repo-branch branch_name
When attcah to container, git recognizes the git repo int the repo folder, but does not recognize repo in repo-branch folder