Thanks to @harsh-patel and @marina-liu for the useful instruction!
Unfortunately, just pulling the other repository removed for some reason commit timestamps from git blame at github for one of the projects.
So after preparing the repositories I merged them into a monorepo a bit differently, thanks to this article.
mkdir monorepo && cd monorepo && git init
git remote add repo1 <URL for repo1> -f
git remote add repo2 <URL for repo2> -f
git merge repo1/main --ff-only
git merge repo2/main --allow-unrelated-histories
git add remote origin <monorepo URL>
git push -fu origin main
(in my case the main branches are called main
and not master
)