Following Setting up password-less connection with GitHub in TortoiseGit article, here are tips on how to setup password-less connection between your GitHub account and your local repository operated under Netbeans. The easiest way to setup password-less connection, is to do this on initial GitHub repo clone or pulling. And it will be presented this way, in following article.
Most important: Do not use method shown in my Setting up password-less connection with GitHub in TortoiseGit. For some reason (unknown to me) Netbeans can't work with keys generated by
Puttygen. Use GitHub article on generating SSH keys instead.
If you're Windows user, you have to use
Git Bash console, instead of regular
cmd console (at least this article does not covers using it). It is available, when you install
msysgit (look here for more details).
In normal conditions, you install
msysgit prior or next to installing TortoiseGit, because it requires it. However, if you don't use TortoiseGit at all (for example you're fine with Netbeans internal Git client), you either have to install
msysgit alone (to have access to
Git Bash) or any other Windows port of Linux tools (like Cygwin for Windows) or you have to "fight" hard, translating paths and command from GitHub article to standard Windows
OK. I assume you're, where GitHub article left you. That is, you've added your public key to your GitHub account (Step 3) and you've tested, that your private key (stored in path expressed in "Your identification has been saved in" message) is valid and can be used to login to GitHub without password (Step 4).
Git Bash gives Linux-like paths, even on Windows, so
/c/Users/[you]/.ssh/id_rsa file (in "Your identification has been saved in" message) corresponds to
[you] is your Windows user name. Decide at this step, whether you're going to leave your private key in this default folder or copy it (by any way) to another location. Keeping this file in default location (along with public key
known_hosts file) is recommended as long as you don't have good reasons for moving this file to another location (and/or renaming it).
Let's start with cloning GitHub repo as a new Netbeans project.
Follow these steps:
1. Start with
Team > Git > Clone and specify GitHub repository's using SSH-like URL (usually it is something like
git as user name, even if you see
git@ in the beginning of URL. This is one of many Netbeans wakos. In some dialogs it is able to extract user name out of URL (automaticaly cuts of
git@ from URL and place it in
Username) and on some (like this) it don't. To make things even more crazy, even though you have
git@ in URL, the entire thing won't work (at least in Netbeans 7.3) if you leave user field empty (
Auth cancel error, whatever this means).
Private/Public Key option and enter (or browse) location of your private key (see above) into
Private Key File. If you secured your private key with a passpharse (very recommended -- see here), enter it to the field below and tick
Save Passpharse. Hit
4. Select remote branch in second step of this wizzard and set destination directory (to where GitHub repository should be clonned to) in the third step. Make sure, you're referencing an empty (or non-existing) directory as you can't clone to directory containing anything. Hit
5. Wait few seconds and click
Create Project... in openned dialog box. Follow the standard way of adding new Netbeans project, selecting
PHP Application with Existing Sources. Provide any information you want or you usually provide and finish adding new project process.
If everything went without troubles, Netbeans will write all necessary data into your local copy meta files (
.git folder). Next time you call on
Team > Git > Remote > Push, to push your local changes to GitHub, you should not be asked for a password or passpharse. Your entire pushing process should be limited to serie of clicks on
Next > and
Why cloning? What about existing local repositories?
Well... I had too many problems when trying to force Netbeans to use existing local copy of GitHub repository (created with TortiseGit), as well as SVN repository (created with TortoiseSVN) that I dropped the entire idea.
From now-on, if on any system I'm switching from TortoiseGit (or any other Git client) to Netbeans, I always comit and push all local changes, delete entire folder and clone it back (checkout in case of Subversion) using tools in Netbeans.
This is the quickest, least painful way.