I started using GitHub services few weeks ago and I had few problems with my favorite PHP IDE [Zend Studio 9]. Even if there is a new feature for GitHub Projects on the latest version I couldn’t manage to make it work properly with a private multi-user GitHub Repository. As a result I switched to a free PHP IDE which satisfies all my needs for GitHub Projects.
In this article I will show you how to add your GitHub Project, Pull your project from GitHub, work with it, Commit and finally Push it to GitHub Repository.
Create PHP Project – Aptana Studio
Step 1: Go to File -> New -> PHP Project (if PHP Project is not on the list, click on Project… and select PHP Project inside the pop-up window).
Step 2: Set a name for your project inside Project Name field.
Step 3: Choose the location of your project on your local drive. To do this deselect Use Default Location checkbox and click on Browse.
Step 4: Choose PHP Project Compatibility by selecting a PHP version from Compatibility select-list. I recommend you to use PHP 5.3.x for the moment since it is the latest stable version of PHP – check the latest stable version on PHP.net
Step 5: Click Finish. Your project will be added into Project Explorer Perspective located on the left side of Aptana Studio 3.
In order to use our current project with GitHub we have to share and link our project to a GitHub Repository. I will show you how to do this in the following steps.
Share Your Project to a local repository
Step 6: Right-Click on Project Name, select Team -> Share Project…. After you clicked on Share Project there will appear a new window.
Step 7: Click on Project Name as it appears under Project column on the new window. Note: Do not click on Path or Repository because it will not select the instance of the project.
Step 8: After you clicked on the Project Name, there will be an active button called Create on the bottom of the window. Click on it. Do not change the value of the input field next to the button because it automatically sets the address of .git-config file inside your Project Folder.
Step 9: By clicking the Create button you will notice that Repository field will be populated with the .git-config file address. Click on Finish.
In this moment you will notice that your project name will have [master] added at the end of the name. This means that the project is shared. In the following steps I will show you how to link the project to your GitHub Public/Private Repository.
Link to Github
Step 10: Right Click on Project Name – Select Team -> Add Remote…. A new window called Add Git Remote will pop-up.
Step 11: Set the New Remote Name to origin if it is not already set by default to origin.
Step 12: Remote URI represents the GitHub Repository Address. You will note that on your account you have 3 different addresses: SSH, HTTP, Git Read-Only. You will need to copy and paste the SSH address inside Remote URI field. Ex: [email protected]:danielrosca/MyRepository.git
Step 13: Select Track checkbox and click OK.
Your Project is now linked with GitHub Repositories.
Note: You need admin privileges to a repository in order to access its SSH address.
Check Aptana Studio – GitHub Connection
Let’s check if it works or not: Right Click on Project Name – select Team – Pull. It will take a while, but after that you should have all the repository files inside your Aptana Studio PHP Project.
Commit your Aptana Studio PHP Project Changes
Edit any of your file/s and save it/them. In order to share your edit you have to commit and push your changes to GitHub. If you followed all the steps by now it will be easy to continue and commit your changes to your GitHub Repository.
Step 14: Right click on Project Name – select Team – Commit.
Step 15: A new window will appear. It will contain all the files that you have added or changed in the left side. In order to commit your changes you have to move the files to the right side. Aptana Studio provides functionality for one-file move or all-files. Move any of your reviewed files to the right side.
Step 16: You can not commit if you not write a message. In the message box write what have you changed or added to your repository and press Commit.
All the changes were committed to your local repository and they are not visible on GitHub. You can continue to work with your project on your local repository and commit as many times as it is required. You are not forced to push to GitHub any single commit. Follow the next steps in order to push your changes to GitHub Repository.
Push to Github
Step 17: Right click on Project Name – Team – Push: it will take a while and after all your local commits were pushed to GitHub you will receive a message on Git console.
Right now you can go to GitHub website and refresh your repository. You should be able to see all your changes and commit messages.
One Comment to “Aptana Studio 3 and GitHub”
[...] with this. I assume that you already have a project created [If not, you have a tutorial for this here]. Moreover, I assume that you also have a FTP [...]
来源: http://www.danielrosca.ro/blog/en/aptana-studio-3-and-github/