Labels

Android (1) bash (2) boost (2) C (34) C++ (2) cheatsheet (2) CLion (6) css (3) Debian (33) DL (17) Docker (2) Dreamweaver (2) Eclipse (3) fail2ban (4) git (5) GitHub (4) Hacking (3) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (31) javascript (3) Linux (167) Mac (19) Machine Learning (1) mySQL (48) Netbeans (4) Networking (1) Nexus (1) OpenVMS (6) Oracle (1) Pandas (3) php (16) Postgresql (8) Python (9) raid (1) RedHat (14) Samba (2) Slackware (47) SQL (14) svn (1) tar (1) ThinkPad (1) Virtualbox (3) Visual Basic (1) Visual Studio (1) Windows (2)

Sunday, 29 August 2021

Configure Netbeans to use ssh key with GitHub

Following a recent change to GitHub, username and passwords would no longer work with Netbeans and others when interacting with repositories. Other IDE's such as Jetbrains are able to use Tokens but Netbeans proved to be a little more stubborn.

SEE NOTE BELOW

So, we firstly need to check if we have a private/public key, see here.

do;

cd ~/.ssh
ls -al

On my mac I have the private and public keys respectively:

id_rsa
id_rsa.pub

If needed, generate a public key by;

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

see here

from inside the .ssh directory, do the following to copy your key to the clipboard;

pbcopy < id_rsa.pub

see here to add it to GitHub.

You can test the connection by;

ssh -T git@github.com

see here

Additionally some notes regarding a passphrase can be found here.

Finally, the GitHub connection window in Netbeans should look like the below;


To update any existing remotes from URL's to SSH, do;

Change to the directory of the project.

git remote -v

This will list the URL's and we can then do;

git remote set-url origin git@github.com:plisken1/repository_name.git

We can then verify by running git remote -v again and we should see the changes.

 

NOTE

While the above ssh key seems to work fine with Mac OS, I could not get it to work under Linux, see here.

This does however seem to work with a Personal Access Token as per the screen shot below;

 

here we used the https format for the repository URL and paste our token string into the password field. 

The token string will be in a format similar to:

ghp_G8sh7FVdje7Q0PJnie3...

No comments:

Post a Comment

Note: only a member of this blog may post a comment.