Search code examples
gitpushclonemirror

git push all remote branches to a new origin


Say I have a repo cloned from Remote A and now I want all Remote A branches to clone to Remote B repo. I have tried to use git push --mirror but it didn't work. How can I solve this?


Solution

  • After setting new origin:

    git remote set-url origin git://new.url.here
    

    I have used:

    git push origin refs/remotes/origin/*:refs/heads/*