pull/push from multiple remote locations

后端 未结 15 1244
傲寒
傲寒 2020-11-21 10:17

The short: is there a way to have a git repo push to and pull from a list of remote repos (rather than a single \"origin\")?

The long:

15条回答
  •  醉话见心
    2020-11-21 10:26

    I wanted to work in VSO/TFS, then push publicly to GitHub when ready. Initial repo created in private VSO. When it came time to add to GitHub I did:

    git remote add mygithubrepo https://github.com/jhealy/kinect2.git
    git push -f mygithubrepo master
    

    Worked like a champ...

    For a sanity check, issue "git remote -v" to list the repositories associated with a project.

    C:\dev\kinect\vso-repo-k2work\FaceNSkinWPF>git remote -v
    githubrepo      https://github.com/jhealy/kinect2.git (fetch)
    githubrepo      https://github.com/jhealy/kinect2.git (push)
    origin  https://devfish.visualstudio.com/DefaultCollection/_git/Kinect2Work (fetch)
    origin  https://devfish.visualstudio.com/DefaultCollection/_git/Kinect2Work (push)
    

    Simple way, worked for me... Hope this helps someone.

提交回复
热议问题