简体   繁体   English

Egit:如何将Eclipse项目(本地存储库)与远程存储库同步

[英]Egit: how to synchronize eclipse project ( local repository) with the remote repository

I'm new to Git version controlling. 我是Git版本控制的新手。 I use EGit plugin with eclipse which again I haven't used before. 我将EGit插件与eclipse结合使用,这也是我以前从未使用过的插件。

My question is, I have created a project (on PC1) in eclipse that is connected with a remote repo which is hosted on Github. 我的问题是,我已经在eclipse中创建了一个项目(在PC1上),该项目与托管在Github上的远程仓库连接。 I can commit and push them to the remote repo using EGit plugin via eclipse. 我可以使用Eclipse通过EGit插件提交并将其推送到远程仓库。

If I work on the same remote repo from another computer, say PC2 and i have made some changes to the repo from PC2, how can I sync my code on PC1 with the remote repo and see the changes visually? 如果我在另一台计算机上处​​理同一远程存储库,比如说PC2,并且我已经对PC2的存储库进行了一些更改,如何将PC1上的代码与远程存储库同步并直观地看到更改?

if I go to Team -> i can see Synchronize Workspace but that is not what I want and again I don't understand the purpose of it as well (have attached a pic)? 如果我去团队->我可以看到“同步工作区”,但这不是我想要的,而且我也不明白它的目的(附有图片)? 在此处输入图片说明

If I goto Team -> Merge.. below is what I see. 如果我转到“团队->合并...”,则会看到以下内容。 It doesn't give me the option to merge with the remote repository and see? 它没有让我选择与远程存储库合并并看到吗? 在此处输入图片说明

Ok so I found the answer. 好的,所以我找到了答案。 you have to add the following line to the config file under .git 您必须将以下行添加到.git下的配置文件中

add following to the [remote "origin"] section: 将以下内容添加到[远程“来源”]部分:

fetch = +refs/heads/ :refs/remotes/origin/ 提取= + refs / heads / :refs / remotes / origin /

Thanks to the answer in this post: EGit: cannot push, cannot pull 感谢这篇文章的答案: EGit:无法推动,无法拉动

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM