问题描述
我的Windows计算机:有一个用于Visual Studio项目的本地git存储库(R1)。该存储库的远程(来源)是GitHub。它们只与Master分支相同。 (所有提交都被推送到GitHub。) NAS(本地y:驱动器):有一个未使用的git仓库(R2)裸,没有其他事情发生在这里。
我想要做的(我认为)是R2的原点远程的R1,并且GitHub原点远程R2。开发将发生在R1(或其他R1.x在不同的PC上),提交到R2。有意义时,R2分支将被推送到GitHub。
我不完全确定的是我如何从我所处的位置到我想要的地方,而不会造成混乱的事情。任何帮助/方向将是最受欢迎的。感谢您,Jon
在您的R1 repo上: git remote set-url origin path_to_R2
在你的R2 repo上: git remote add origin url_to_github_repo
,然后 git fetch
完成。
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
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.
这篇关于Git Remotes可以级联吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!