Eclipse在github上创建代码仓库

1. Create a java project(e.g GitWithEclipseDemo for my demo) in your eclipse. And create some classes

Eclipse在github上创建代码仓库

2. Right click project -> Team -> Share Project...

Eclipse在github上创建代码仓库

3. Configure Git Repository window will be displayed. Then click 'Create' button.

Eclipse在github上创建代码仓库

4. Click 'Browser..' button to select a folder in your PC to set repository directory. This direcory is a local git repository.

In this case, I set my repository directory is 'C:\Users\Administrator\Documents\GitHub', and click 'Finish' button.

Eclipse在github上创建代码仓库

5.Click 'Finish' button in the Configure Git Repository window.

Eclipse在github上创建代码仓库

6.Go to Window -> Show View -> Other. Then the 'Show View' window will be displayed and to find Git section. Select 'Git Repositories' and 'Git Staging' and click 'Ok' button.

Eclipse在github上创建代码仓库

7.As step 6 to select 'History' item under Team section.

Eclipse在github上创建代码仓库

8. Right click project -> Team -> Commit..

Eclipse在github上创建代码仓库

9. Commit Changes to Git Repository window will be displayed. Type Commit message and select files that you want to commit and click 'Commit' button to commit.

In this case, I want to commit all files under 'GitWithEclipseDemo' project

Eclipse在github上创建代码仓库

10.Go to your own github website and click 'New' button to create a new repository in Github.

Eclipse在github上创建代码仓库

11. Type the Repository name and click 'Create Repository' button to create a new repository in Github.

In this case, I created 'GitWithEclipseDemo' repository in my Github.

Eclipse在github上创建代码仓库

12.Copy the URL the Github provided.

Eclipse在github上创建代码仓库

13.Back to eclipse and find Remotes under Git Repositories. Right click -> Create Remote...

Eclipse在github上创建代码仓库

14. Type the name for the new remote and click 'Ok' button

In this case, I used 'demo' for my remote name.

Eclipse在github上创建代码仓库

15. Configure push for remote 'demo' window will be displayed. Click 'Change' button.

Eclipse在github上创建代码仓库

16. Copy the URL that provided by Github(Refer Step 12), and type the User and password(this user and password can login your github). Click 'Finish' button.

Eclipse在github上创建代码仓库

17. Click 'Advanced' button in the Configure push for remote 'demo' window.

Eclipse在github上创建代码仓库

18. Select 'master' for Source ref and click 'Add Spec' button.

Eclipse在github上创建代码仓库

19.A new Mode will be added after clicking 'Add Spec' button in the Step 18.

Eclipse在github上创建代码仓库

20. Find demo in the Remotes section under Git Repositories. Right click -> Push

Eclipse在github上创建代码仓库

21.A push results  window will be displayed.

Eclipse在github上创建代码仓库

22.Go to your Github website, you can find your local sources had been pushed in Github now.

Eclipse在github上创建代码仓库

End. If you do some changes in your project(e.g. change code), you can Commit and Push it into Github.




转载自:http://www.cnblogs.com/hongten/p/github_eclipse.html