mkdir foo; cd foo
# move to a scratch dir
git clone --bare https://github.com/exampleuser/old-repository.git
# Make a bare clone of the repository
cd old-repository.git
git push --mirror https://github.com/exampleuser/new-repository.git
# Mirror-push to the new repository
cd ..
rm -rf old-repository.git
# Remove our temporary local repository
你可以直接在 Github 上做,我觉得这样更容易。
在创建了一个空的新存储库(子存储库)并希望它具有与(父存储库)相同的代码之后,
click on the Code on the top bar. At the buttom, pick the last opion which says (...or import code from another repository). You will be prompted to enter a clone link of the repository you wish to import your code from. Paste the clone link of your (Parent repository) and press import.