As a programmer, you often need to write code when learning, but because of the computer or other reasons, the code may be lost, inconvenient to review and review later. If there is a version of the server, not only can the upload code, when needed is ready to download, but also to achieve version control, to see what changes in each version. GitHub is a good choice at this point.
1. To use GitHub, you first need to register a GitHub account and create a repository. This has basically become a necessary skill for every programmer, so don't dwell on it here.
2. Install the Git plugin on eclipse
First choose Help, Install New software:
Pop up the following window and click the Add button:
Pop up the following window and enter the appropriate content:
The value of name can be entered arbitrarily, it is recommended to see the name of the meaning;http://download.eclipse.org/egit/updates
。
Select the default down to OK. You will need to restart eclipse after the installation is complete.
User information for GitHub needs to be configured in the configuration, Team-I, Windows, Preferences.
3. Create a Java project in eclipse (this article takes a Java project as an example, other projects are similar). Right-click on the project name to select Team--Share project:
Select Git and click Next:
The first time you need to tickUse or create repository in parent folder of project
Select the item, clickCreate Repository
When you are done, you create a git repository on this computer. A small icon for the question mark appears in the file in the project.
At this point, you can submit the code to the local repository, and on the project, right-click on team--commit
You can select a file to submit, or you can select Submit all.Commit message
must be filled in.
ClickCommit
button to submit the code to the local repository. Of course you can also clickCommit and Push
button to submit the code to the local repository and upload it to GitHub.
If you click on the Commit button, the next step is to push the code onto GitHub. Right-click Project Select Team--Remote---Push
Enter the URI of the repository created earlier on GitHub
Host and repository path are automatically generated and do not require input. User and password need to be entered.
Next select the branch, where master instead of head is selected.
Then click Add Spec
Click Done to upload the success. At this point, check to see if the code has been uploaded on GitHub.
If the upload is not successful, the previous step may not be checkedForce Update
。 It is recommended to check each upload.
This is all done.
Eclipse submits the code to its own github