Since TomatoCart repository is migrated to the Github from Google Svn, you have to access the repository with Git. I prefer to work with Git and Eclipse. This article discusses how to set up and use eGit (the Eclipse version of Git) with Eclipse Standard 4.3.
Installing Eclipse with PHP and Git
To Install Eclipse with PHP and Git, follow these steps:
- Install Eclipse Standard 4.3 from Eclipse Downloads. This will give you a version of Eclipse with Java, XML and HTML file editing (but without eGit or PHP).
- To add eGit and PHP, go to Eclipse→Help→Install New Software, as shown below.
- Select Indigo update site as shown below.
- This will present a list of all of the available Eclipse plugins. Select the three git options under Collaboration, as shown below.
- Then click through the rest of the wizard and accept the terms of the license agreement. At this point, the requested plugins will be downloaded. After this, you will be prompted to restart Eclipse (which you should do).
At this point, you should have PHP and eGit installed with Eclipse. Confirm this by selecting Window→Open Perspective→Other and make sure that the PHP and Git Repositories perspectives show on the list.
Clone the Remote Repository
One easy to way to clone a remote repository is using the Git Repositories view in Eclipse. Here are the steps:
- Click the Git Repositories view and then clone a repository as shown below.
- Then, you have to select repository source. Just select URI and click Next.
- At this point, we need the URL from Github. We can use either SSH or HTTPS. SSH requires that you have created SSH keys in Github and stored them in Eclipse. Find the desired repository in Github. Here, we use the HTTPS method. Please select HTTPS as the protocol and fill in your Github user name and password, again checking the box “Store in Secure Store”. This is shown below.
- Select the desired branch and click Next. As you can see, there are three branches in our repository.
- Next we select the local destination for the repository. This will normally be the same as the project location for the PHP project. The remote repository name defaults to “origin”, as shown in the example below.
- At this point, the repository should show in the Git Repositories view as shown here
Create the PHP Project
At this point, we have the local repository created. Now we want to create a PHP project in the same directory that we used for the repository. Here are the steps.
- Select File→New→PHP project as shown here. Enter the directory for the new project. This will normally be the same as we used for the local repository. Note that we get the warning message indicating that the location already exists. That is expected.
- Click Finish. We should have PHP project with all of the files from remote repository
Share the PHP Project
At this stage, we have our local project in Eclipse. However, it is not associated with the Git repository. To do that, we have to “share” the project. Here are the steps.
- Right click on the project to show the context menu. Select Team→Share Project as shown below.
- The Share Project form will show. Select Git and click Next.
- The Configure Git Repository form will show. Click on the check box “Use or create repository in parent folder of project”. And then just click finish to make the project under version control.