Can Git Remotes be Cascaded?

浪子不回头ぞ 提交于 2019-12-11 09:46:16

问题


My Windows Computer: Has a local git repository (R1) for a Visual Studio project. The remote (origin) for this repository is GitHub. They are identical with just a Master branch. (All of the commits have been pushed to GitHub.)

NAS (local y: drive): Has an unused git repository (R2) that was created "init --bare" and nothing else has happened here.

What I would like to do (I think) is have the R2 the origin remote of R1, and GitHub the origin remote of R2. Development would occur in R1 (or other R1.x on different PCs) with commits pushed to R2. When it makes sense, the R2 branch(es) would be pushed to GitHub.

What I am not exactly sure about is how I get from where I am to where I want to be without making a mess of things. Any help/direction would be most welcome. Thanks, Jon


回答1:


On your R1 repo: git remote set-url origin path_to_R2

On your R2 repo: git remote add origin url_to_github_repo and then git fetch

Done.



来源:https://stackoverflow.com/questions/23642343/can-git-remotes-be-cascaded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!