Skip to content

Instantly share code, notes, and snippets.

@pborissow
Created January 30, 2025 17:46
Show Gist options
  • Save pborissow/11bae00d7945c7acbff32418e8016a8b to your computer and use it in GitHub Desktop.
Save pborissow/11bae00d7945c7acbff32418e8016a8b to your computer and use it in GitHub Desktop.
Netbeans and Git

How to use Netbeans with Git

Upload project to a Git repo

Step 1: Initialize Local Repository

Team->Git->Initialize Repository

Step 2: Update Committer

Add the following lines to the .git/config file (e.g. [Project Node]->Git->Repository->Open Configuration)

[user]
        name = yourname
        email = youremail

Example:

[user]
    name = Peter Borissow
    email = [email protected]

Step 3: Commit Local Changes

Step 4: Create Remote Repository as needed (e.g. GitHub, GitLab, etc.)

Step 5: Commit to remote repository

Team->Remote->Push

Specify Git URL (https://....)

Create project from a Git repo

Step 1: Create empty project in Netbeans (e.g. javaxt-core)

(1) File -> New Project...

(2) Close the project

Step 2: Clone a Git repository

(1) Team -> Git -> Clone...

(2) Enter the Git URL, username and password

(3) Specify a directory where to download a copy of the repository. Unfortunately, Netbeans won't let you download directly into the project created in Step 1. Instead, download into a temporary directory. Example: "temp/git/javaxt-core"

Step 3: Move Files

Merge the directory created in step 2 into the directory created in step 1

Step 4: Open Project

Step 5: Update Committer

Add the following lines to the .git/config file (e.g. [Project Node]->Git->Repository->Open Configuration)

[user]
        name = yourname
        email = youremail

Example:

[user]
    name = pborissow
    email = [email protected]

Reference

https://netbeans.org/kb/docs/ide/github_nb_screencast.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment