I created a repository in Github for my PHP team project.
So, I want to share how I did that step-by-step.

Software: NetBeans IDE 8.0.2

1. [GitHub]   I created a repository for the team project in my GitHub account.
Repository Name: [my project name], e.g. PHP-project
So, I have a repository under my account as “Jeesoo/PHP-project
Then, master branch is created as a default.
(Many branches can be created later on for version control , and there are “merge” or”rebase” as collaborating each branch to master branch.)

2. [GitHub] I invite collaborators, i.e. team members, as going to “setting>collaborators”.
Then, add collaborators. Make sure in advance to know the GitHub username of team members.

3. [NetBeans] create a project.

4. [NetBeans]select a project -> go to the main menu, “Team>Git”.  Then, select “Initialize Repository”

5. [NetBeans]Then, a pop-up window will show the Root path of the project.
If you want to change the path, now is the time to change it. Otherwise, leave as it is in default setting.
Click OK

6.[GitHub] Copy the URL of the project in GitHub.
There is a section in the right column, “HTTPS clone URL”.

7. [NetBeans] While the project is selected, go to the main menu.
Team> Commit
Then, “Commit- PHP project” window will be popped up.
Commit Message:  enter the title of the commit, e.g. “New commit”
Below the Message text area,  a list of “Files to Commit” will be displayed in green and checked.
Click “Commit” button.

8. [NetBeans] Team>Remote>Push…
Then, you will see a new pop-up window, “Push to Remote Repository”.
Select the second radio button, which is “Specify Git Repository Location”.
As a default,  you will see “Remote Name: origin”, “Persist Remote” checked. Leave them as they are.
“Repository URL” : paste here the cloned URL of GitHub repository.
“User:” enter your Github user name
Password: Github login password.
Them. Click Next.

9.[NetBeans] “Select Local Branches”
Since you are MASTER, select “master -> master[A]”
Click “Next”

10.[NetBeans] “Update Local References” : Select remote branches you want to update under remotes in the local repository
Check “master -> origin.master[A]”
Click Finish.

11. [NetBeans] New pop-up window asking you “Set Up Remote Tracking?”
(Branch “origin/master” created locally. Do you want to set up branch “master” to track the remote branch?)
Click “YES”.
Finally, your local branch is connected to GitHub Repository.
*********************************************************

NEXT

*** How to “Clone” the already created GitHub repository (by someone else) into your local working directory ***

1. [netbeans] Create a new project for clonning(downloading) the team project in GitHub

2. [netbeans] Select the project created (where files in github will be downloaded)

3.[Github] clone the URL of the github repository that you want to clone (download) into your local directory.

4. [NetBeans]Team>Git>Clone  : pop-up window “Clone Repository”

5. [NetBeans]Remote Repository URL: paste the url copied.
Enter your GitHub username and password
Click Next

6. [NetBeans]Remote Branches: check  “master*” , which was created by an owner of the github repostitory.
Click Next.

7.  [NetBeans]Destination Directory:
Parent directory: where your project is located
Clone name: enter your project name
Checkout Branch: “master*” (default)
Remote name:”origin” (default)
“Scan for NetBeans Projects after Clone” checked.
Click “Finish’

8. [NetBeans]Clone Completed

9. [NetBeans]Whenever you change/update the file for this cloned project,
“commit” > “remote”> “push” will do the job .

 

Now, all team members share the same files in the same structure by committing and pushing changes to this remote repository. Cool! This is really cool.