You could do something like this:
Firstly add 'repo a' locally
git remote add repoa https://github.com/user/repoa.git
Then do a git push to that repo
git push repoa
Likewis eadd 'repo b' locally
git remote add repob https://github.com/user/repob.git
Then do a git push to that repo
git push repob
Doing this will push up the current state of the entire repository.
Now clone the repositories separately:
cd /path/where/you/want/new/repos/to/be
git clone https://github.com/user/repoa.git repoa
git clone https://github.com/user/repob.git repob
(where repoa
as the 2nd param is the directory you want to clone into)
and for each run git rm -r
with the directories/files you want to remove from that repo, for example for repo-a:
git rm -r src/repob docs/repob
Repeat the above again for repo-b.
Then for each repository run the following command to stage the deletions for commit:
git add -u
Then make a commit as you usually would:
git commit -m "Deleted files from repo b"
Then push
git push origin
Repeat the last 3 commands again for repo-b.
This will create two separate repositories with the complete history of all the files within the repo, unfortunately I don't know a way of retaining the history of 'only the files in that repo'.