If you’re looking to push your code to github via netbeans then you just stumbled upon the right post. Continue reading to find out how.
1. You need to have git installed.
1. You need to have already created a github account.
2. You have developed your project or application using netbeans.
Once you have the pre-requisites then you’re ready to move on. Follow these steps to get your project on github.
- Select Team from the menu bar in your netbeans IDE.
2. Hover over to Git and select Initialize Repository…
3. Input the root path of your project. This should be the folder path of where your project is located. You’ll notice your java classes in your netbeans ide tabs will turn to green
4. Once you have latest changes saved in your project, you can once again select Team and select Commit.
5. A dialog box will appear. Enter the commit message and thereafter hit the commit button. You might be asked if you want to set your user domain(firstname.lastname@example.org) as the default author depending on whether you’re on a network. Select yes to do so.
6. Now head over to github and login with your credentials. Click on new repository.
7. Enter the repository name, description. Select whether you want to create a public or private repository. Opt in or out to initialize the Repository with a Readme file and then click create repository.
8. Once you’ve created your repository, click on clone or download and copy the link of your project.
9. Head back to your netbeans ide.
10. Now push your project to your remote repository which is on github. Do so by heading to Team => Remote => Push
11. Enter your repository link and the valid credentials to access your repository
You might encounter this error when you push to the repository.
To fix this error, head over to Team => Remote => Pull
A dialog box appears for you to enter credentials to the remote repository. Once you’re done, a new dialog box pops up
Click on merge to synchronize your current branch to the branch on your remote repository.
Now head back to Team => Remote => Push . Enter your repo credentials and select the branch you want to push the project to.
Your project should now be successfully pushed to your github repository.