1

Using Netbeans 8.1 in Windows and Git on Linux CLI.

I have a Netbeans project, with source files residing on a mapped SMB share from a linux machine. Netbeans' version of the repository is stored local to this machine, and I do not commit from Netbeans. All of my commits are made via Git on the remote machine.

Is it possible to setup Netbeans to use the remote repository read-only, and update its history when the remote git commits to the repo?

John
  • 115
  • 8
  • I suppose another way to look at it is this: If someone wanted to manage a Git repo with one Git server, such as Git for Windows, but read-only use the repo with Netbeans. That the repo is technically stored on another machine/OS is not particularly important. – John Aug 25 '16 at 22:19

1 Answers1

2

This would not be specific to Netbeans, but you can configure your local repo to prevent pushing:

git remote set-url --push origin no_push

As for the update, unless you setup some kind of webhook on the remote repo side (which a simple repo does not have, contrary to a Git repo hosting service like GitHub), you would need to fetch at regular interval.

If you don't need to be in sync at all time, you can simply pull and rebase before pushing.

git config pull.rebase true
git config rebase.autoStash true

Again, not specifc to NetBeans, but Netbeans will take into account those local Git repo settings.

If someone wanted to manage a Git repo with one Git server, such as Git for Windows, but read-only use the repo with Netbeans.

One simple answer: take an archive of your repo and unzip it somewhere for NetBeans to use: this is no longer a Git repo, and NetBeans does not risk to add any commit to it.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you. The repo is hosted on GitHub, so commits do eventually make it into Netbeans when I push from the other local, but I commit much more frequently than I push. – John Aug 25 '16 at 22:17
  • Thank you... but that still seems to be another version of the same problem: the repo the IDE is trying to maintain stays out of date vs the actual repo for the files it is editing. Currently, things catch up only when I push to origin. In the meantime, code-highlighting of differences show the diffs versus the last push, rather than the last commit. – John Aug 29 '16 at 16:46