[JAVA] [Eclipse / github] Let's share the project created with eclipse on github For beginners

What is eclipse?

One of the integrated development environments (IDE) Not only can you write the source code as an editor, but it also includes server software and executes the program in a form closer to the actual production, which is a very amazing guy.

What is github?

Click here for github I won't explain it here, so let's check it out (throw it from the beginning)

Premise of this article

--I am creating an empty repository on github (How to create it) --Eclipse is installed (this article uses eclipse for Java)

Now, let's upload the project created with eclipse, which is the purpose of this article, to github.

Share your eclipse project on github

First, create a project for uploading

  1. Click File → New → Other
git_eclipse00.png

  1. Web → Dynamic Web Project → Click Next
git_eclipse01.png

  1. Enter "GitTest" in the project name (any name you like)
  2. Click Finish
git_eclipse02.png

  1. Right-click on the created project
  2. Click Team → Share Project
git_eclipse03.png

  1. Git → Click Next
git_eclipse04.png

  1. Check Use or create repository in the project's parent folder
git_eclipse05.png

  1. Click "Git Test"
  2. Click Create Repository
  3. Click Finish
git_eclipse06.png

  1. Right click on "Git Test"
  2. Click Team → Commit

git_eclipse07.png


  1. Click the green ++ mark
  2. Enter "1" in the commit message (anything is fine)
  3. Click Commit and Push
git_eclipse08.png

  1. Enter the clone URL that you copied to the URI (See this article as a bonus)
  2. Enter your github user ID and password
  3. Click Next
git_eclipse09.png

  1. Click Next
git_eclipse10.png

  1. Make sure the expected push result is rejected
  2. Click Finish
git_eclipse11.png

  1. Confirm that the push result is rejected
  2. Click Close
git_eclipse12.png

Let's get rid of the reason for being rejected

The push was rejected, so I checked the github repository and the data was not uploaded Even if I'm investigating, there are many cases where there is no description on how to break through here, so I will continue to describe how to do it.

  1. Right click on "Git Test"
  2. Click Team → Pull
git_eclipse13.png

  1. Click Close
git_eclipse14.png

  1. Right click on "Git Test"
  2. Click Team → Push Branch
git_eclipse15.png

  1. Click preview
git_eclipse16.png

  1. Make sure the expected push result is not a rejection
  2. Click push
git_eclipse17.png

  1. Make sure the push result is not rejected
  2. Click Close
git_eclipse18.png

  1. Sign in to github and make sure it's uploaded successfully -** If you can confirm it, sharing to github is completed **
git_eclipse19.png

What are commits, pushes, and pulls?

――Commit is to save data in the repository of the local PC. In the game, save function to the main unit --Push is to upload the repository of your local PC to github on the Internet. Sending cloud saves in games --Pull means to download a repository saved on github on the Internet. In terms of games, receiving cloud saves

Why was the first push rejected?

** Briefly, to ensure data integrity ** At the stage of the first push, the state of the empty repository on github was not received, and if you push it as it is, it may overwrite all the data, so it was rejected By pulling and receiving the status of the repository on github, the repository and the data I created are consistent, and uploading is now possible.

Original way

If you do not create new file when creating an empty repository and perform this procedure as it is created, the first push will not be rejected (If you do not create a new file, there is no evidence that you have operated the repository, so save it by overwriting No problem) However, I came to write this article because there was a beginner who was stuck for about 3 days because he shared it on the second and subsequent PCs and accidentally created or messed up a file.

Recommended Posts

[Eclipse / github] Let's share the project created with eclipse on github For beginners
Must-see for beginners! How to manage your Xcode project on Github
Import nablarch-example project on github into Eclipse
Must-see for beginners! Specific method to manage X code project on Github ②
[First team development ③] Share the development environment created with Docker
Challenge the settings for developing with vue.js on Rails 6
[For beginners] Install JDK + Eclipse on Mac (without Pleiades All-in-One)
[Android Studio] [For beginners] Let's roughly explain the screen and directories
[Android] Dynamically set the height of ListView with copy (for beginners)
The first thing to do when you want to be happy with Heroku on GitHub with Eclipse in Java
CI for Maven project on AppVeyor
Environment construction with Docker for beginners
Programming with ruby (on the way)
"Hello world" for ImageJ with Eclipse
Image processing: Let's play with the image
[Java] Deploy a web application created with Eclipse + Maven + Ontology on Heroku