首页 技术 正文
技术 2022年11月14日
0 收藏 876 点赞 2,380 浏览 1167 个字

1、简介

2、安装

3、配置

4、使用

5、补充说明

 

参考资料: http://yufenfei.iteye.com/blog/1750124 

 

1、简介

    EGit就是一款Eclipse上的Git插件。

 

2、安装

【CentOS】Eclipse插件egit使用

【CentOS】Eclipse插件egit使用

EGit插件地址:http://download.eclipse.org/egit/updates

OK,随后连续下一步默认安装就可以,安装后进行重启Eclipse

 

3、配置

准备工作:需要在https://github.com 上注册账号

Preferences > Team > Git > Configuration

【CentOS】Eclipse插件egit使用

这里的user.name 是你在https://github.com上注册用户名

【CentOS】Eclipse插件egit使用

user.email是你在github上绑定的邮箱。在这里配置user.name即可

 

4、使用

提交本地仓库:

1、新建项目 git_demo,并新建HelloWorld.java类

【CentOS】Eclipse插件egit使用

2、将git_demo项目提交到本地仓库,如下图

【CentOS】Eclipse插件egit使用

【CentOS】Eclipse插件egit使用

【CentOS】Eclipse插件egit使用

到此步,就成功创建GIT仓库。但文件夹处于untracked状态(文件夹中的符号”?”表示),下面我们需要提交代码到本地仓库,如下图

【CentOS】Eclipse插件egit使用

【CentOS】Eclipse插件egit使用

【CentOS】Eclipse插件egit使用

OK,这样代码提交到了本地仓库

 

提交远程仓库:

1、准备工作:在https://github.com上创建仓库

【CentOS】Eclipse插件egit使用

【CentOS】Eclipse插件egit使用

点击“Create repository” ,ok,这样在github上的仓库就创建好了。

注意创建好远程仓库后,点击进去,此时可以看到一个HTTP地址,如红线框,这个是你http协议的远程仓库地址

【CentOS】Eclipse插件egit使用

 

2、准备工作做好了,那开始将代码提交到远程仓库吧

【CentOS】Eclipse插件egit使用

【CentOS】Eclipse插件egit使用

【CentOS】Eclipse插件egit使用

【CentOS】Eclipse插件egit使用

【CentOS】Eclipse插件egit使用

【CentOS】Eclipse插件egit使用

OK,这样提交远程GIT就完成了,可以在https://github.com核对一下代码是否已经提交

【CentOS】Eclipse插件egit使用

注意的问题

   如果是首次提交会第一步:先在本地建立一个一样的仓库,称本地仓库。

          第二步:在本地进行commit操作将把更新提交到本地仓库;

          第三步: 将服务器端的更新pull到本地仓库进行合并,最后将合并好的本地仓库push到服务器端,这样就进行了一次远程提交。

  如果非首次提交同样的道理

          第一步:将修改的代码commit操作更新到本地仓库;

         第二步:第三步: 将服务器端的更新pull到本地仓库进行合并,最后将合并好的本地仓库push到服务器端

 

3、clone远程仓库:

       【CentOS】Eclipse插件egit使用

       【CentOS】Eclipse插件egit使用

       【CentOS】Eclipse插件egit使用

      【CentOS】Eclipse插件egit使用 

      【CentOS】Eclipse插件egit使用

 

5、补充说明:

    对于git服务器的Eclipse访问,也是类似的:push到git服务器的配置如下:

         【CentOS】Eclipse插件egit使用

前提条件:

        需要在git服务器新建Python.git的仓库,然后使用ssh  push到服务器

 

错误解决:

       【CentOS】Eclipse插件egit使用

解决方案:

         初始化远程仓库时使用git  –bare  init  不要使用 git  init

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,083
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,558
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,407
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,180
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,817
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,900