git将所有分支从一个远程推送到另一个远程

git将所有分支从一个远程推送到另一个远程

问题描述:

我有两个远程站点:上游站点和源站点.上游是我无法推动的.起源是我自己的回购.如何从上游获取所有分支,然后将其推入原点? 我试过了:

I have two remote: upstream and origin. upstream is something I can't push to. origin is my own repo. How can I fetch all branches from upstream and then push them to origin? I tried:

git fetch upstream
git push --all origin

但这是行不通的.

您可能希望尝试使用--mirror选项克隆上游存储库,然后也使用--mirror选项将其推送到新的远程服务器上.

You may want to try cloning your upstream repo with --mirror option and then push to your new remote with --mirror option too

您将具有以下流程:

git clone <upstream-repo-url/repo.git> --mirror
cd <repo>
git remote add <your-remote-name> <your-remote-url/repo.git>
git push <your-remote-name> --mirror