Third article of Eclipse IDE Plugins is about importing a Git project into Eclipse using EGit. This is useful when working with such project that are placed in public places such as GitHub or if you are working on project which has many developers.
To follow this tutorial you have to have Eclipse installed on your operating system and EGit. If you haven't installed EGit, you can follow the first Eclipse tutorial which shows how to install an Eclipse Plugin.
You also have to have configured EGit which I have shown on the second Eclipse tutorial.
Importing a Git Project into Eclipse
Opening code from git. This section of the guide covers how to open code a git repository in Eclipse. It is very important that you DO NOT simply open the project: instead, you must import the code as a general project. You should also make sure you're connected to the internet when performing these steps. EGit is the Git integration for the Eclipse IDE, see This Tutorial describes the basic use cases for EGit. It requires only some basic knowledge about the Git processes. Please help us to keep this tutorial up-to-date by reporting any issues or questions.
Start Eclipse and go to the File menu and choose Import.
Git Project
Surf in the Import menu to Git and select Projects from Git
URI
Depending on the situation, but on this tutorial I will show you the way for URI. So choose URI at this point.
Configurations
Here you see example data how to write the configurations, I'm using ssh as a protocol as it is most widely used. Click next when you are done editing and Eclipse will try to connect and fetch for Git repository.
Repositories
Depending on the found Git repositories, you will see the repositories here.
Directory
Next we choose the directory where to place our local Git repository. I use the default one.
Importing to Eclipse
Eclipse asks how would you like to import the project. The usual way for Eclipse projects is to import it as an existing project.
Just select here the project you are importing and Eclipse imports the project.
Importing Finished
Now if we go right click our imported project and go to Team we will see all the important Git functions.
Using EGit
- Commit – When you want to make a commit, select Commit and window will popup which asks for files to commit.
- Push to Upstream – When you have made a commit, you can Push those changes to the server with this command. Username and Password are needed to use this command.
- Fetch from Upstream – When you want to update your project with the latest commits someone else have made to the Git repository, you have to use this command. Usename and Password are needed for this command. Remember to use Pull after this.
- Pull – If you have fetched some changes from the Upstream, you have to Pull these changes to Eclipses working project. Usename and Password are needed.
- Show in History – This one shows you the history and made changes in the project on its lifetime.
You can get around with these commands in the world of Git and Eclipse, if you get some special needs, I'm sure you will find answers pretty fast with some Googling.
I hope these Eclipse Plugins tutorials have been helpful and maybe you have learnt how to use Git, it's a very good tool in version controlling and preventing disasters in software development. Of course there are some bad things but you will eventually find those yourself.
- Navigation
- Main Page
- Community portal
- Current events
- Recent changes
- Random page
- Help
- Toolbox
- Page information
- Permanent link
- Printable version
- Special pages
- Related changes
- What links here
- 8Creating a new repository
List of Git repositories available
Please see http://git.eclipse.org/.
Committers new to Git
Before working on a Git repository, please:
- Read Git for Dummies
- Read The Git Parable
- Have the Git Guide handy
- Also, check out EGit
- Consider editing your Eclipse project website using Orion
Consider editing your Eclipse project website using OrionHub- Note that anyone can commit to their repo, but only Eclipse committers can push their repo to git.eclipse.org
- DON'T FORGET to configure your git environment. The 'commit' record must contain either your Eclipse User ID, or the email address registered with the Eclipse Foundation.
Next we choose the directory where to place our local Git repository. I use the default one.
Importing to Eclipse
Eclipse asks how would you like to import the project. The usual way for Eclipse projects is to import it as an existing project.
Just select here the project you are importing and Eclipse imports the project.
Importing Finished
Now if we go right click our imported project and go to Team we will see all the important Git functions.
Using EGit
- Commit – When you want to make a commit, select Commit and window will popup which asks for files to commit.
- Push to Upstream – When you have made a commit, you can Push those changes to the server with this command. Username and Password are needed to use this command.
- Fetch from Upstream – When you want to update your project with the latest commits someone else have made to the Git repository, you have to use this command. Usename and Password are needed for this command. Remember to use Pull after this.
- Pull – If you have fetched some changes from the Upstream, you have to Pull these changes to Eclipses working project. Usename and Password are needed.
- Show in History – This one shows you the history and made changes in the project on its lifetime.
You can get around with these commands in the world of Git and Eclipse, if you get some special needs, I'm sure you will find answers pretty fast with some Googling.
I hope these Eclipse Plugins tutorials have been helpful and maybe you have learnt how to use Git, it's a very good tool in version controlling and preventing disasters in software development. Of course there are some bad things but you will eventually find those yourself.
- Navigation
- Main Page
- Community portal
- Current events
- Recent changes
- Random page
- Help
- Toolbox
- Page information
- Permanent link
- Printable version
- Special pages
- Related changes
- What links here
- 8Creating a new repository
List of Git repositories available
Please see http://git.eclipse.org/.
Committers new to Git
Before working on a Git repository, please:
- Read Git for Dummies
- Read The Git Parable
- Have the Git Guide handy
- Also, check out EGit
- Consider editing your Eclipse project website using Orion
Consider editing your Eclipse project website using OrionHub- Note that anyone can commit to their repo, but only Eclipse committers can push their repo to git.eclipse.org
- DON'T FORGET to configure your git environment. The 'commit' record must contain either your Eclipse User ID, or the email address registered with the Eclipse Foundation.
- Note that the above will set this as the default user name and email address to use when writing commits. You can set user.name and password on a per repository basis.
This will set the username and email address on just the current git repository.
Git or Gerrit?
All new repositories at Eclipse.org now use Gerrit for access, even if the project does not make use of its code review features. Some mature projects are still using Git. To find out what the project uses, please ask the project, or find the repository on http://git.eclipse.org/c/
When looking at the repositories, those using the Gerrit Code Review tool are identified as such. Please see Gerrit for more on Gerrit Code Review.
Your Git identity at eclipse.org
Your correct Git committer_id identity is at eclipse.org can be found on the Gerrit settings page. Your user ID is the same for SSH Git and Gerrit.
Note that it is NOT the same as your wiki.eclipse.org Username (which is essentially your email address), or bugs.eclipse.org Email Address.
Your Git password is your Eclipse.org site account password as set on https://dev.eclipse.org/site_login/myaccount.php.
Gerrit maintains its own password for https: https://git.eclipse.org/r/#/settings/http-password. Gerrit also maintains its own SSH keys: https://git.eclipse.org/r/#/settings/ssh-keys These passwords and keys are only used for Gerrit and are not interchangeable with the eclipse.org credentials. Gerrit over SSH does not permit password authentication. A public key must be uploaded for Gerrit over SSH.
If your firewall blocks SSH (port 22) and Gerrit SSH (29418) please try the https:// URLs provided by Gerrit.
Connecting, cloning a repo
Please see the list of Git repositories (above).
Committer access:
These services are provided via Gerrit.
Anonymous, read-only access:
Committing and pushing
IP process implications of DVCS
Due to our rigorous IP process, the Eclipse.org use-case for a DVCS is different than that of other Open Source organizations. For this reason, an update hook is installed and must remain in place on every Git repository to ensure a clean IP provenance.
The Eclipse update hook will examine the Committer entries of an incoming push. All the committer entries must be of committers on the project, or the push will fail. Furthermore, your committer ID, or the committer email address registered with your committer account at the Eclipse Foundation must be present in the Committer Email record. Here are some scenarios to help understand this restriction:
Please see Handling Git Contributions for information on how to handle 'pull' requests from non-committers.
Creating a new repository
Please file a bug(community -> git) if your project needs a new repository created.
Using Markdown for README/CONTRIBUTING
The cGit web view at http://git.eclipse.org/c/ supports rendering a Markdown, HTML or plaintext file in the root of the repository, in the master branch, as the 'About' tab. In the root of the repository, the file names below are searched (in the order listed). Note: case is important. Such as a file name of 'README.MD' will not trigger the 'About' tab to be displayed, even though though the /about/ will still display the markup.
- CONTRIBUTING
- CONTRIBUTING.md
- README.md
- readme.md
- README.mkd
- readme.mkd
- README.rst
- readme.rst
- README.html
- readme.html
- README.htm
- readme.htm
- README.txt
- readme.txt
- README
- readme
- INSTALL.md
- install.md
- INSTALL.mkd
- install.mkd
- INSTALL.rst
- install.rst
- INSTALL.html
- install.html
- INSTALL.htm
- install.htm
- INSTALL.txt
- install.txt
- INSTALL
- install
Permanently deleting code from Git
If you are required to permanently remove code from a Git repository, please open a bug against Community/Git and Webmaster will do this for you.
Setting up ssh keys
Eclipse Ide Gitignore
Please login to Gerrit(https://git.eclipse.org/r) to manage your public keys for ssh access.
Referencing git repositories on the wiki
To include a reference to your Git repository on your wiki page, you can use the Git Link Template. This links to the web interface where readers can get an overview of the repository, browse the source code, and see some commit stats. Here is an example:
org.eclipse.ecf.git (browse, stats, fork on OrionHub)
You don't need Git to get code from repository
As mentioned in bug 329841 you can use the cGit web interface to get code, if you just need the code, and do not need to clone the repository, say to prepare patches or commit changes back in to the main repository.
- This is useful for things like checking out test scripts, say to a hudson slave, there you just need the files to
start a larger test process, such as using Ant's get task to get a URL such as
- It can also be useful to refer to a single file for (temporary) reference or review, such as
Eclipse Ide Git Windows 10
Gerrit Code Review
If you want to add code review to your Git tool box then see Gerrit.
If your project has requested HTTPS push access, and your are trying to clone(anonymously(via HTTP or GIT)) and receiving 'Corrupted object' warnings:
- Try to commit a change via ssh(or have another committer on your project do so)
- Ask your rel-eng to check the permissions on the object in the repo ( should be at least 444 )
If the ssh commit works, and the permissions are not ok then either file a bug, or send a note to Webmaster asking to have the default mask on your git repo repaired. See bug 363599 for details.
Eclipse Ide Git Integration
The following resources are recommended reading for anyone new to Git or patch-based distributed version control systems in general. Feel free to add links here to reading that you found to be useful.
- EGit/User Guide - describes the dialogs and commands that can be accessed for the EGit eclipse plugin
- Pro Git - a handy description of how git works and some of what git can do
- Git SCM - the main git site
- msysgit - A git client and bash shell for windows - might need some crlf flags set, not sure.
- Git workflows - a blog post about Git workflows
- The Git Parable - A document describing how Git works
- Subversion Re-education - A guide to the conceptual differences between revision based systems like Subversion/CVS and patch-based systems like Git/Mercurial.
- Git tutorial from Lars Vogel - Describes the usage of the Git command line
- EGit tutorial from Lars Vogel - Describes the usage of the EGit team provider
- Provide a description for your Git repository by editing the description file in the repository root. This description is used in a couple of different places to help the community understand the purpose of the repository. Keep the description concise (e.g. one line of prose).
- Provide a CONTRIBUTING file in the root of your Git repository. GitHub, for example, encourages this convention to help members of the community understand how to contribute to the project.
- TODO provide an example of this
- Note that an Eclipse project cannot simply accept a Git pull request. Before a pull request can be accepted, the contributor must have agreed to the Eclipse Terms of Use. A contributor who has an Eclipse account implicitly makes this sort of agreement.
- Please see Handling Git Contributions for further information.