Eclipse submits a project using Git

Source: Internet
Author: User
Tags using git

Common development projects are carried out on IDE development tools, such as Java Project Development on Eclipse. If the code is submitted directly to the local repository on eclipse, it is submitted to the remote server on GitHub. This will bring great convenience to the developer.

Similar to the eclipse on the remote server submitted via SVN. Since the Eclipse development tool comes with plugin git, we can use it directly.

Here's how to configure and use Git to submit code to a local repository and push to a remote server.

First, configure the user name and password

Bring your own git plugin to configure our user name and password, which is the user and password to sign up for GitHub. windows--perferences--team--Git--configuration

where the. Gitconfig configuration can be understood as a setting file for the MAVEN configuration warehouse.

Second, the Eclipse on the build SSH2 key,github on the configuration SSH key, for the SSH way to submit the code ( Note: If you are using the https+ user name and password submission method, this step two do not refer to )

Eclipse Generation SSH2 key:windows--Perferences--general--network Commection--ssh2--key management--general

Then register the generated SSH key on GitHub and log in to Github--settings--add to paste the SSH key generated by the appeal.

Note: This method is equivalent to the command line method, the company computer and its own laptop to paste the generated SSH key, you can add a lot of SSH key

See if the generated key is in the default system disk (C-drive), and some people will install it on other disks.

Then paste the generated public key onto GitHub:(This step cannot be omitted, be sure to check the generated public key with the command)

If the step is not operational, execute the command: $ ssh-t git@github. com to report such errors:

Three. Submit project code using GIT

Right-click Project "Team"--"Share project"--"Git"--"next"

As shown in this project "Testgit" will become a git repository, to open the project under workspace, found a hidden file ". Git, ( build the project repository on GitHub remote and then clone to local ) but the project is in the untracked state (the symbol in the folder "?"). ), we need to submit the code to the local repository, such as:

First we have to ignore unnecessary files such as the MAVEN Project target folder (the submission code directly filters things that do not have to be submitted, of course it can not be configured, when committing to choose what to commit)

Configure the. Gitignore to exclude this folder, open the Navigator window, add the. gitignore file to the project root directory, and write the directory to which you want to exclude control to the. gitignore file:

This way, git commits to filter out some unnecessary files, if you want to filter other folders or files directly in the ". Gitignore" Write, the specific wording of the reference:

Then submit the modified file must first add and then commit through the team, add to index can add files to the git index for version monitoring:

If you do not want to add to the repository, the "Remove from Index" command is not a commit, and the command does not work if it is already a commit. The file status changes after the add succeeds by the previous "? "Into" * ":

Details: In git, you can add untracked files to the index and submit updates by default as long as commit, no separate operation is required

Last commit: (The Master branch is automatically generated after the first commit)

Enter the submission information in the comment:

To this project "Testgit" on the local submission success. Next we submit the local project to the remote remote repository on GitHub:

Make the following settings:

The drop-down box is selected as follows:

Then proceed as follows: Note: If "Force Update" is checked, it means overwrite the commit

Click "Next" to appear as shown:

Finally click Finis, log on to GitHub to see if the upload was successful.

The following appears to indicate the success of the upload.

Iv. How to recover an uncommitted modification file:

Eclipse submits a project using Git

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.