I think the commands you are looking for are:
git checkout master
git remote add r1remote **url-of-repo1**
git fetch r1remote
git merge r1remote/master --allow-unrelated-histories
git remote rm r1remote
After that repo2/master will contain everything from repo2/master and repo1/master, and will also have the history of both of them.
--allow-unrelated-histories
参数需要git 2.9以上支持, ubuntu自带源没有,需要按照git官网添加源
https://git-scm.com/download/linux