摘要:

实现:git->eclipse的,eclipse->git双向

1.安装egit插件

在Eclipse中选择help->Eclipse Marketplace,在search中输入egit,找到后安装即可

Eclipse中使用github

2.导入github项目

2.1.在github上找到你要导入的源码项目,比如: 
https://github.com/sumoli/gallery-by-react.git 

2.2.从Eclipse中选择File->import->Git->Projects from Git 

Eclipse中使用github


点击下一步 

Eclipse中使用github

选择next,进入分支选择,这里选择的是master 

Eclipse中使用github

选择next,配置本地项目存放路径 

Eclipse中使用github

选择next,选择 

Eclipse中使用github

Eclipse中使用github

点Finish,就导入到本地了,如下图示 

Eclipse中使用github

3.提交到github

3.1.本地仓库-github 

3.1.1.提交到本地仓库 

Eclipse中使用github

Eclipse中使用github

点击Commit按钮就可以把代码提交到本地仓库(当然也可以点击Commit and Push按钮提交代码到本地仓库并上传至GitHub),这里采用commit 

选中需要提交的文件,双击可查看修改内容对比,点击commit,提交完成后

3.1.2.同步到github账户 
如何提交到GitHub账户下呢?就要把代码Push到GitHub上。右键项目选择Team -> Remote -> Push 

Eclipse中使用github

点next-next 刷新git账号页面就出现了 

Eclipse中使用github

3.2.一键同步github项目 

直接commit-commit and push

4.eclipse同步项目到github

新建一个eclipse工程 

右键项目->team->share project

Eclipse中使用github

Eclipse中使用github

勾选 Use or create repository in parent folder of project 

然后点击 

Eclipse中使用github

目录会发现多了一个.git文件夹。 

右击”项目”->Team->commit 本地提交 

Eclipse中使用github

Eclipse中使用github

下一步,即可 

备注:提交的地址要预先在github上面创建一个空工程地址,如果点提交,刷新github页面没有提交上去,可点击上图的Force Update。提交即可。

5.技巧与问题

5.1.配置用户账号信息 
Window -> Preferences -> Team -> Git -> Configuration中配置GitHub的用户信息。 
5.2. 报错there are no staged files 

提交如果报错there are no staged files,则去windows->preferences 配置勾挑掉 

Eclipse中使用github

转载来源地址:

https://blog.csdn.net/qiyeliuli/article/details/51798725


相关文章:

  • 2021-07-12
  • 2021-07-02
  • 2021-11-11
  • 2021-07-05
  • 2021-06-09
  • 2021-05-13
  • 2022-01-11
  • 2021-07-15
猜你喜欢
  • 2021-12-21
  • 2021-04-29
  • 2022-02-06
  • 2021-11-30
相关资源
相似解决方案