LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > omgiamlinux
User Name
Password

Notices


Rate this Entry

Day 4.7 How to use github.com with NetBeans 7.0

Posted 10-27-2011 at 04:52 PM by omgiamlinux
Updated 10-27-2011 at 06:33 PM by omgiamlinux

Prerequisits:
a. Install git on your computer (I did this with git bash on windows)
b. Install NetBeans
c. Setup a free account at github.com
d. Install a plugin called git in NetBeans
Hint:
Tools -> Plugins -> Available Updates (TAB) -> git (checkbox) -> Install (button)


I. To import a new project into NetBeans from git hub, perform the following.

1) In git bash, move to your NetBeansProjects folder and clone a repo:
Code:
$  cd ~/documents/netbeansprojects
$  git clone git://github.com/thisismygit/hellogit_php.git hellogit_php
That will give you readonly access. To do read/write access, use this clone command instead:
Code:
$  git clone git@github.com:thisismygit/hellogit_php.git hellogit_php
(note: If you attempt this second command, your terminal will give you jazz about not having permissions. That's because I haven't added your SSH key to my white list of keys on my github account. Play around with your own account for maximum fun).


That will download the project files into your NetBeans folder (explicitly naming it's folder hellogit_php which was redundant in this case, btw). You can now open the project in NetBeans by:

1) Open up NetBeans
2) File -> Open Project
Your project should be visible in the panel displayed to you! Select it and click "Open Project" =)



Make an arbitrary change to your index.php file. I decided to add a line to the php section:
Code:
echo "<br>pweez?";
Save the change, and right click the project node.

Code:
git -> Add
git -> Commit
After you click on the "Commit" item, you'll be presented with a panel that wants you to add a message to your commit. I just filled in something about adding a pweez line.

Then you're done in NetBeans. Drop back into the git bash so you can push the repository up to origin.
Code:
$  cd ~/documents/netbeansprojects/hellogit_php
$  git push -u origin master
BooYah! You just uploaded your changes! Aren't weblogs fun! Of course you would only be aloud to upload your changes if it was your account and you added your ssh key to the white list in github.com


II. To upload a NetBeans project to github

1) Create a blank PHP project in NetBeans.
2) Create a new repository on github.com
3) Drop into git bash

4) cd to the new PHP project's folder and prepare the git repository.
Code:
$  git init
$  git remote add origin git@github.com: < insert your user account name > / < insert your github project name >.git
5) Add all the NetBeans files to the repository of course.
Code:
$  git add .
$  git commit -m 'first commit of every file in the NetBeans project'
Then you may push the repository into the space you created for it on github.com
Code:
$  git push -u origin master

OK, I've been banging out so many tutorials these last few days, I have a feeling I'm running out of steam, so plz, if you try following this and things don't work out for you, let me know below.
Views 898 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 12:39 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration