Eclipse uses Git's most basic process

Source: Internet
Author: User

There are many benefits to git, and it's clear from the web that I won't repeat it here. For me, if I wanted to do some projects privately, and I couldn't save my Code and version control well, I used git. Now, let me take a personal example of how Git installs and uses it from 0 onwards.

STEP1 preparatory work

Msysgit, for http://msysgit.github.io/.

Eclipse IDE for Java EE Developers (must be this, bring your own egit, or install the Egit plugin yourself), download at Eclipse website, address/HTTP/ www.eclipse.org/downloads/.

GitHub account, the website of GitHub register one, address https://github.com/.

Liaoche's Git tutorial, the address is http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000, speaks very well, I spent about 3 nights to see if it was just for the sake of installation, you can skip it for a while and look back.

STEP2 Msysgit Installation

All the way next, note that you may encounter 360 interception (damn, click Allow all operation of this program or exit 360 before installation).

STEP3 git user name and mailbox configuration

Click the Start menu, open git Bush,

Enter the following command

git config--global user.name "Your name"

git config--global user.email [email protected]

The user name and mailbox are replaced by their own, specifying the user name and email address for all warehouses in this machine.

Step4 Create SSH Key

Because SSH is encrypted between the local git repository and the remote GitHub repository, you also need to create an SSH Key.

Enter the following command

Ssh-keygen-t rsa-c [email protected]

Also replace the mailbox with your own. In path C, user--user name, locate the. SSH folder, open to see two files Id_rsa and id_rsa.pub,

Open id_rsa.pub, copy the contents (this is equivalent to a key, the person holding the key can access your content, the next summary of the use of the key), the following is my

STEP5 associated with a warehouse on GitHub

Sign up for a GitHub account

Once the registration is complete, click on the settings (that is, the gear, set icon) in the upper right corner.

Go to Settings page

Choose SSH keys, click on the Add SSH key, you can add, the title is filled out, will be copied from the Id_rsa.pub content pasted here. From then on, the Gitgub warehouse will be able to identify your local warehouse. That is, you are only one step away from pushing local code to GitHub, or cloning the code on GitHub locally. (can refer to Liaoche predecessor's tutorial advanced line in non-eclipse operation, more feel)

Use of Step6 Egit

First, log in to your GitHub account, click the plus sign, select New Repositrory, and create a fresh repository.

The name is Test2, and the others are all by default.

Click the green button to create a GitHub repository.

Copy the address and save the backup.

Open Eclipse and, as usual, create a new Web project or other project that you use frequently. My project here is called Scott.

Right-click the project and select Team->share Project, which pops up the following window.

Select Git,next, in the Popup interface, ① first check the use or Create......,②createrepository,③ check the project, ④finish.

At this point, you create a git project, right-click on the project, select Team, you can do commit,synchronize like SVN, but in the remote operation, push is gray, indicating that the code cannot be pushed to the GitHub repository.

At this point, open the Git repository view (specifically how to open Baidu, this is the basic common sense)

Right-click Create Remote, click OK

Click Change to bring up the following screen

The URI is entered in the previously copied address on GitHub, and the content below is automatically filled in. You just need to fill in the username and password on GitHub. Finish,save.

The next few steps are simple, write the code in the project, and then submit the new code locally, for example, the Cat class, add to index first, then commit. At this point, the right-click Project, with the push option in team->remote, means you can save your local code in GitHub. Congratulations to you!

Click on Push, click Add All Branches Spec, add the local repository, then finish, follow next, and see GitHub again to see that the code has been pushed successfully.

Finally, take a look at our code on GitHub!

Eclipse uses Git's most basic process

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.