git mirror repository

C++
cd myrepo
git fetch origin
git push --mirror <remote_repo_git_url>
Source

Also in C++: