Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Beginner Problems
Beginner Problems [message #1808718] Sun, 30 June 2019 02:06 Go to next message
Reinhardt Christiansen is currently offline Reinhardt ChristiansenFriend
Messages: 73
Registered: March 2010
Member
Although I am familiar with the concept of version control and like it, I have not been in an environment where I needed to use it in many years so I am trying to get up-to-date with it. Since I've been an Eclipse user for a long time and Git/GitHub is clearly a very popular version control system, I'd like to get familiar with accessing GitHub from Eclipse. I have done some tutorials on basic Git and GitHub operations using the GitHub web interface and the Git command line but I am just beginning to try to access GitHub via Eclipse, specifically 2019-03.

I'm very confused by the documentation and I hope you will forgive me asking some very basic questions.

1. The Help system in Eclipse refers to two different Gits, EGit and JGit. Am I correct in understanding that JGit is for Java projects and EGit is for other projects? I have a mix of different projects, both Java and web projects, and I'm not sure which of these Gits to use for web projects, consisting of HTML, CSS, and PHP but not Java. I'd like to use the right Git for each type of project.

2. Is it possible for me to connect EGit (or JGit if that's what I should be using) to a REMOTE GitHub repository? I've been trying to follow the instructions in the EGit manual and it seems to imply I *can* access both local and remote repositories but I can't find complete instructions that work for accessing a remote repository in GitHub. I've already created a repository in GitHub for one of my current projects and uploaded each of the files to that repository. But I'm getting lost in the instructions because they tell me to get the URLs for either SSH or HTTP from GitHub and I'm not finding that information. I've also tried clicking on Team/Share Project for that project but it only seems to let me create a local Git repository not a remote GitHub repository.

3. If I have an existing project that isn't using any form of version control, am I supposed to create the repository from within Eclipse and then push all the files out to the remote repository from Eclipse?

I should mention that I don't plan to collaborate with anyone at the moment, although I may make want to make my repository accessible to potential employers as I apply for jobs. Currently, I am using the repository mainly as a backup in case my local hard drive(s) fail and, of course, to get more familiar with Git/GitHub. I'm hoping to build up a code portfolio of a few projects that will show employers what I can do.

Re: Beginner Problems [message #1808735 is a reply to message #1808718] Sun, 30 June 2019 16:55 Go to previous messageGo to next message
Thomas Wolf is currently offline Thomas WolfFriend
Messages: 174
Registered: August 2016
Senior Member

  1. EGit is the UI in Eclipse. JGit is a Java implementation of git used by EGit. There is no separate git integration for different projects; it's always EGit for the UI and underneath JGit for the actual git operations.
  2. To work with a remote git repository on Github, you first clone that remote repository. This gives you a local copy of the whole repository (the "clone"). Then you work with that local clone (check-out, commit, switch branches, ...). To send your committed changes to the remote repository (sometimes called the "upstream" repository) you push. From time to time, you pull or fetch from upstream to get changes in the remote repository (for instance, if someone else pushed something) into your local clone. See more below.
  3. No. Easiest is to create the repository at Github first, then clone it. Then use the "Team->Share Project..." context menu; choose the local clone. Then push. Of course, if you want to add the project to a repository that you have already cloned, just go to "Team->Share Project...".

To get the local clone for (2) above, you have two possibilities:

  • Find the clone URL of the Github repository. There's a "Clone or download" button top right on the Github page of the repository, click it to see the URL(s). Open the "Git Repostories" view in Eclipse ("Window->Show- View->Others...", under "Git") and clone with that URL.
  • Install "Eclipse GitHub Integration" ("Help->Install New Software...", use this update site for the URL); then follow this guide.

For a general introduction to git and git in Eclipse I recommend

  • The official Pro Git book.
  • Lars Vogel's tutorials on git and on EGit.
Re: Beginner Problems [message #1808843 is a reply to message #1808735] Tue, 02 July 2019 22:44 Go to previous messageGo to next message
Reinhardt Christiansen is currently offline Reinhardt ChristiansenFriend
Messages: 73
Registered: March 2010
Member
Thank you VERY much for your reply, Thomas! I appreciate you taking the time to answer. (Some of my questions elsewhere in the Eclipse forums have been ignored despite seeming very appropriate.)

I've downloaded the Pro Git book and glanced at Lars Vogel's tutorials. I am amazed at how lengthy these materials are, given that Git is so widely used and I've seen so many assurances that it is "simple" to use.

After posting my question, I decided to look on YouTube to see if anyone had done something on using Git/GitHub with Eclipse. (That didn't go very well when I tried finding out how to debug PHP with XDebug because all the Eclipse references were years out of date and Eclipse has changed a lot.) But I did find a reasonably good video on GitHub + Eclipse which finally showed the proper sequence of doing things. I found that my intuitive guess at how things were done was very wrong. So, for posterity sake, I want to acknowledge this video here in case anyone else has some of the same confusions I do:

https://www.youtube.com/watch?v=LPT7v69guVY

Unfortunately, I have not been entirely successful in imitating what he shows in the video, which is less than 2 years old. I created my (initially empty) repository in GitHub and cloned the repository in Eclipse and associated it with one of my projects in Eclipse, apparently successfully because when I choose Team/Commit.... I get a screen that lets me stage my files and then Commit or Commit and Push. When I try to commit and push a small number of files, I get an error message suggesting I use Git Large Files. This makes little sense to me since the files are just small CSS or SCSS files, not huge BLOBs. This happens even when I try to commit and push a single CSS or SCSS file of a hundred lines or so. Do you - or anyone else reading this - have any idea why that would happen?

I'm also puzzled by why it takes so very long for the push/commit to even fail. After several minutes, the process is only at 94% and the rest of the process seems to be ever slower. Is there something I need to change in my setup to speed things up AND also succeed? I can't imagine the Eclipse and GitHub can't handle even a single small text file, let alone the rest of my code.

I'm going to start working my way through the Git Pro and Vogel tutorials but I thought I'd just ask my new questions here in the hopes that I can solve the problem a little more quickly. It's going to take a while to work through the other materials.

Thanks again for your help so far!
Re: Beginner Problems [message #1808877 is a reply to message #1808843] Wed, 03 July 2019 17:36 Go to previous message
Thomas Wolf is currently offline Thomas WolfFriend
Messages: 174
Registered: August 2016
Senior Member
Reinhardt Christiansen wrote on Tue, 02 July 2019 22:44
I get an error message suggesting I use Git Large Files. This makes little sense to me since the files are just small CSS or SCSS files, not huge BLOBs. This happens even when I try to commit and push a single CSS or SCSS file of a hundred lines or so. Do you - or anyone else reading this - have any idea why that would happen?

I'm also puzzled by why it takes so very long for the push/commit to even fail. After several minutes, the process is only at 94% and the rest of the process seems to be ever slower. Is there something I need to change in my setup to speed things up AND also succeed? I can't imagine the Eclipse and GitHub can't handle even a single small text file, let alone the rest of my code.

No, that's definitely not normal. I have no idea where a message suggesting to use git LFS (large files) might come from; maybe from GitHub because your commit does somehow include large files all the same?

Check which files actually are in your commit. (Show In->History in context menu; then in the history view select the commit and look in the file list bottom right.)
Previous Topic:Comparing files from "Unstaged Changes" showing whitespace which should not be there
Next Topic:Modify commit message from Eclipse plugin
Goto Forum:
  


Current Time: Fri Dec 06 11:10:24 GMT 2019

Powered by FUDForum. Page generated in 0.01327 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top