在两台计算机中共享一个存储库 [英] Sharing a Repository Among Two Computers
问题描述
- 我有一个 git仓库, Computer1
- 我推送到GitHub上的存储库
- 现在我在 Computer2 我希望存储库也存在于 Computer2 上
- 我希望能够在两台计算机上处理此存储库的代码
我很难确定究竟需要发生什么。对于第3步,我会认为我会执行抓取或拉,但是(除非我读错了)似乎拉下新的和更新的文件。有可能是该存储库中的旧文件,但因为 Computer2 没有它们,所以我希望它们全都是(我猜是存储库的实际副本)。
我不认为我想创建一个分支或 fork 存储库,因为我并不是在寻找2个独立版本。
至于 Step 4 ,一旦前面的步骤完成,我会在每台计算机上考虑执行拉来获取更新的文件。
我的理解是否正确,如果不是我如何完成上述任务?
克隆
Computer2上的github存储库。 从那时起,当你在给定的计算机上完成工作时,你需要 pull
那些c从github到本地副本的更新以更新它。
Computer1 - push - > GitHub
Computer1 GitHub --clone - > Computer2
更改
pre>
|
|
v
Computer1 --push - > GitHub Computer2
Computer1 GitHub --pull ---> Computer2
更改
|
|
v
Computer1 GitHub< - push --- Computer2
Computer1< - pull-- GitHub Computer2
I'm having a hard time grasping how I can accomplish the below task:
- I have a git repository on Computer1
- I push to a repository on GitHub
- Now I am on Computer2 that has zero footprint of this repository and I want the repository to also live on Computer2
- I want to be able to work on this repository's code on both computers
I'm having a difficult time determining what exactly needs to happen. For Step 3, I would think I'd do a fetch or a pull, but (unless I'm reading this wrong) that only seems to pull down new and updated files. There could potentially be old files in that repository, but because Computer2 has none of them I'd want them all (I guess an actual copy of the repository).
I wouldn't think I'd want to create a branch or fork the repository, because I'm not looking for 2 separate versions out there.
And as for Step 4, once the prior steps were complete I would think on each computer I'd just do a pull to get the updated files.
Is my understanding correct, and if not how am I to accomplish the above tasks?
解决方案You want to
clone
the github repository on Computer2.From then on, when you're done doing work on a given computer, you'll need to
push
your changes to github (to update your online copy), and then when you arrive at the other computer,pull
those changes from github to the local copy to update it.Computer1 --push--> GitHub Computer1 GitHub --clone--> Computer2
changes | | v Computer1 --push--> GitHub Computer2 Computer1 GitHub --pull---> Computer2 changes | | v Computer1 GitHub <--push--- Computer2 Computer1 <--pull-- GitHub Computer2
这篇关于在两台计算机中共享一个存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!