The post is also available in: Swedish
Netbeans has supported the version control system Git since 7.0. In this post I will briefly go through how to initiate Git version control for a project in Netbeans and how to sync this with Github.
Right-click in Netbeans on the project you want to start a version control for. In the list that pops up, select:
Versioning -> Initialize Git Repository
You will now get a popup window where you select the folder that the archive should be saved in.
After you clicked “ok” you have set up a version control. To work with Git you can now right-click a file in the project. You see a new choice headlined “Git”. If you hover this you’ll hopefully find a bunch of familiar commands.
Sync with Github
To synchronize your project with github you first start a new repository on github, this is easily done through their website. After you’ve set this up you can return to Netbeans. Make sure you first made a “commit” before we try to “push”.
Right-click the project and select:
Git -> Remote -> Push
You’ll now see the window “Push to Remote Repository”.
Select the second option: “Specify Git Repository Location”.
Write in the box next to the selection something like:
The string above is the ssh path I have to one of my projects on github. You can find the equivalent for your project on github.
The next step is to enter a username. This should be “git”.
Next, we specify an ssh key that is also added on github. Enter the passphrase for this key and click next.
If all has gone well you now have the choice of which branch you want to push to. Check the box for the current branch, then we’re done.
In a similar manner as above described, we can also perform the “pull” and “fetch” commands.