How to add GitHub project to eclipse? Part 02

Hello everyone, welcome to the next level of programming. In today articles, we are going to give you lessons on various topics as how you add your GitHub project to eclipse and how can we create a GitHub repository how do we clone the repository in eclipse how can we add the eclipse project to GitHub, and then how we can finally commit push and pull. So, let’s start.  

How to create a GitHub repository?

Step number one is.

Step 1: Create a GitHub account with a sign in

You will have to create an account on GitHub so, you will go to your browser and you will go to GitHub so, you will say GitHub and the very first website you will get that and github.com so, you will go there and you will create your account so, you will add your you will pick a username you can give some email id or valid email id and then choose a password and then you will sign up for GitHub you will get a link in your email to verify your account and then you will verify and then finally you will sign in so you already will have an account so you will just sign in to your account and now there you will get that page and there you will see that start a project a button so, this is the step no. two

Step 2: Start a project = create a repository

Then you will have to start a new project so you will go and start a new a project and you can give any name so you will give that is a test project and then you will give some description which will optional and make it public and then you will create the repository so click on create a repository and there you will have that new repository and you will have a link of that repository there so now you will go back.

How to clone the repository in eclipse?

Now, what will you do is step number three is

Step 3: Start eclipse

You will start your eclipse so you will go to your eclipse now so that will be an eclipse and you will have to go to git repository perspective so will you see this open perspective button there you will click on that open perspective and then you from there you will have to select git repository also you will start typing git repository there and you will get this perspective and git repository so select git repositories and there you will get that git repositories window and there you will have buttons so that will be an add an existing local git repository that button will be to clone of your git repository and the clone to this view and then you will have to create you git repository so in your case you will already have created your git repository so you will click on that clone or git repository and add that grown to that view so you will click there and before you will add so step no. four will be

Step 4: Go to perspective >> git repositories and click on add git repository

Now, you will add the URL there so you will copy that URL from there that just copy it from there and then go back to eclipse and just paste it there it will take all the hosts and repository path itself and then you will give your authentication which will be your user and the password of GitHub account and even if you will not give it will ask you later on so if you will say next there so it will search for the repository and then finally it will have given you that window you will select next again and then it will give you the local directory so you will change that if you want and then you will say finish and you will see that progress there so it will be cloning the repository from the GitHub remote repository and finally you will see that project will have come there so you will have got your repository into your eclipse now the next thing is you will have to create a project in eclipse and add to this repository. I hope, all this will make you more eager to learn about what you can do with GitHub projects and eclipse.

How to add eclipse project to GitHub repository?

So, step no. five is

Step 5: Create a project in eclipse

So, you will create any project so you will say new java project you will also click there file new and then select the java project so there you will give some name you will give the same name as well that will test project and say finish so you will have got your test project there now what you will do is you will do a right click on that project and then you will go to team and then you will select share project and there it will ask you for the repository and now you will see you will have caught that test project repository there and that will be displayed only once you will have added project in the repository or you will have clone the repository so just select that repository and then you will say finish and now this project will be added to that repository and you will see that icon has also been changed now if you will back to your repository on GitHub and you will refresh it you will not find anything any change there as of now the reason is because you do will have not done any commit or you will have not done any push to the repository so as of now that will be that will look like as before so you will see that will be the same view. Let me add the steps so step no. 6 will be

Step 6: Do a right-click on project >> share >> Add to Git repository

And finally you will do some changes or you will do a commit so, you will do a commit first so you will again do a right-click and go to team and now you will see you will have got all these options and that will come only after you will have added the project to the repository so now you will click on commit and now it will have given you all these changes or additions that you will have done you will select all or you will select the ones that you want to commit and drag and drop to the stage changes area so now you will have staged that you will also add some commit message first commit and then you will do commit and then push or you will do commit and push at one go so you will say commit and push and it will give you that dialog boxes you will say next so you will write it down and it will ask you for the username and password and there will be user and password of your GitHub so your username will whatever and you will add your password and now finally it will give you the branch and as of now you will have only master branch so you will say finish and you will see you will give your username and password again and you will also store this username and password so you will not have to give it every time but as of now you will just give it and you will see the progress there and meanwhile that will have done.    

How to commit, push and pull the changes?

Then step no. seven will be

Step 7: commit and push the project to the repository

You will add commit and push the project to the repository and then step 8 will be whenever you will make any change

Step 8: commit and push every change to the repository

So as of now that will have done and now if you will go to your repository and refresh it you will see that would now show you your project and as well as your commit so you will refresh and see and definitely you will see that you will have got your test project there if you will click there you will get that details inside that test project and you will see all these details and also you will see the first commit there which will have happened just two minutes ago and now if you will make any changes for example: you will create a new class there so you will create a new test class there and now and anytime & every time you will make any change you will just go to do a right click on the project go to team you will say commit and you will see that will show you the changes and you will then add a message added class test dot java and then commit and push so that will commit you will add your username and password and that would commit the changes again to the remote repository and if you will go back to your remote repository and refresh that again you will now see you will have got that change added class test java and if you will go inside the source you will have your test dot java class there so this is how you will make sure all your changes will be committed to your remote repository and this is how you will do a pull push and commit so you will also for example: go to team and then you will have all these options there you will do a pull you will pull or push from a particular branch and then you will commit in all these changes this is how you will add your GitHub project to eclipse and then will push and pull so, I hope, all these lessons will be beneficial for you. These fundamental steps will give you the correct path in the journey of adding the GitHub project to eclipse.

Related video:

Facebook Notice for EU! You need to login to view and post FB Comments!