Eclipse installs the Git plug-in and associates the import Github project

1. Eclipse configure git

1. Check your eclipse version

open eclipse

Navigation: help->AboutEclipse

As shown in the figure:

 

Or find the decompressed file of eclipse and open .eclipseproduct to see it

 

 

 

2. Check if the Git plugin is installed in Eclipse

Go to Help -> AboutEclipse in the menu bar to see if there is an icon for the Git plugin.

  
The current Eclipse download generally provides the Git plug-in. If there is no Git plug-in, you can search for the egit plug-in installation in the eclipse market. If the lower version of eclipse installs the higher version of the egit plug-in, an error will be reported. It is recommended to install the lower version, or Go to the eclipse official website to download the latest eclipse for j2ee, which is not big, only more than 200 M.

Note: The EGit plug-ins found in the general market are all suitable for the latest version of eclipse, so it is recommended

First open ( http://wiki.eclipse.org/EGit/FAQ#Where_can_I_find_older_releases_of_EGit.3F )
the webpage provides the corresponding version of EGit, choose the corresponding version yourself.

Then

Help->Install new software->Add

As shown in the figure:

Then just keep clicking next. After installation, you will be asked to restart Eclipse, click OK, and the git plugin will be installed.
3 Configure Git

Menu bar Window -> Preferences -> Team -> Git -> Configuration, click Add Entry..., add name and email, you need to use name and email information when committing project code to Git. In the dialog box that pops up by clicking AddEntry..., fill in user.name for Key and name information for Value. This is to add name information. When adding email information, fill in user.email for Key and email address for Value. The configuration effect is
 

shown in the figure: 3. Associate Gihub account
1. Log in to Github

Go to the GitHub webpage ( http://github.com ), log in with your GitHub account, or register first if you don’t have a GitHub account yet. 
After logging in to GitHub, click the Newrepository button in the lower right corner to add the project code repository. 
Enter Repository name (it is recommended to have the same name as the project to be submitted), Description (describe a little what this project does), select Public (Private is charged, Public is free, but the corresponding published project code can be viewed by anyone ), and finally click Create repository to complete the creation of the project code repository. 
Specific Git and Github operations recommend Liao Xuefeng's series of tutorials

2.创建Java项目
建立Java项目。菜单栏File -> New -> Java Project,输入Project name,此处输入为Java,点击Finish完成。 
 
创建class文件。将鼠标移到Java项目src文件夹上,单击鼠标右键,New -> Class,填Package和Name,如果需要包含主方法,可以勾选上public static void main(String[] args),点击Finish完成。 

3.关联Git
编写相应的代码 后关联Git。鼠标选中要发布的项目,单击右键,Team -> Share Project,选Git,点击Next。勾选Use or create repository in parent folder ofproject,选中要发布的项目,点击Create Repository,点击Finish完成。 
发布项目。鼠标选中要发布的项目,单击右键,Team -> Commit,填写Commitmessage,勾选全选,点击Commit提交。注意:此时,仅是提交在本地Git,还需要Push才能提交到GitHub中。 
4.发布到Github
发布到GitHub。鼠标选中要发布的项目,单击右键,Team -> Remote -> Push,粘贴URI,填写User和Password,点击Next;点击Source ref的下拉框,选择mast,点击Add Spec,点击Finish,点击OK完成。  
发布后的GitHub项目页面,可以很方便的看到提交的次数,每次提交的备注信息等,非常方便对代码的管理。 

5.Eclipse导入GitHub 项目
从GitHub中取得项目代码。菜单栏Window -> Show View -> Git -> GitRepositories,点击OK;在Git Repositories视图中,点击图示按钮,进入Clone Git Repository对话框;填写URI,User,Password,点击Next;点击Next;选择要保存的路径,点击Finish。至此,项目代码就被下载到指定目录下了,需要使用的时候通过Eclipse Import进来即可。 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326483426&siteId=291194637