With the help of the comments I found the solutions shown below.
0. Fill a separate repository with content of public folder
Push content of folder "public" to new repository:
cd public
git init --initial-branch=main
git remote add origin https://github.com/user/new_repository.git
git add .
git commit -m "Initial commit"
git push -u origin main
A. Use separate repository as submodule "public"
Integrate submodule
Delete public folder inside main folder
Commit main folder (=> apply deletion of public folder)
Add new repository as a submodule "public":
git submodule add -b main https://github.com/user/new_repository.git public
git submodule update --remote
The git submodule add command creates a file .gitmodules containing
[submodule "public"]
path = public
url = https://github.com/user/new_repository.git
branch = main
- Commit and push main folder
Fresh Clone
If someone else does a fresh clone of the main project, the recursive option needs to be used. Otherwise the content of the submodule folder "public" will be empty.

Commit change of submodule
If someone changes the content of the submodule, the submodule and the main project need to be committed/pushed separately. This seems to be a disadvantage of the submodule approach.
If I change a file of the submodule, the main project does not recognize that as a change (list of commit dialog will be empty). Once I committed the change using the submodule folder, the main project does recognize a change (new version of submodule). Then the main project needs to be committed, too.
The push dialog of TortoiseGit has the value "On demand" for the "Recurse submodule" option:

Therefore, at least the push action can be done for both, the main and the submodule project. (If there is a single command to commit and push both, please let me know.)
Related questions on usage of submodules
How do I "git clone" a repo, including its submodules?
How do I "commit" changes in a git submodule?
How to add the content of a git submodule directly in the curent directory, without extra project folder?
git submodule tracking latest
B. Use separate repository as subtree "public"
Include subtree
Delete public folder inside main folder
Commit main folder (=> apply deletion of public folder)
Use subtree command to include files of repository locally
git subtree add --prefix public https://github.com/user/new_repository.git main --squash
- Push main folder (commit is already done by
subtree add
command)
Fresh Clone
- A fresh clone includes all files of the subtree. In comparison to submodules no extra command or option is required.
Commit change of subtree
A change in the subtree is recognized by the parent/main project as normal file change and is committed with the main project by default.
When committing to the main project, the repository for the subtree is not automatically updated.
In order to apply the local changes to the subtree repository, use following explicit command:
git subtree push --prefix public https://github.com/user/new_repository.git main --squash
Its possible to introduce an alias for the url, so that the over all length of the command gets shorter, using git add remote
, see https://www.atlassian.com/git/tutorials/git-subtree
Pull changes of subtree
git subtree pull --prefix public https://github.com/user/new_repository.git main
Related articles on subtree