This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 203614

Summary: cannot clone private github repository with public/private key
Product: versioncontrol Reporter: wjohnsonga <wjohnsonga>
Component: GitAssignee: Ondrej Vrabec <ovrabec>
Status: RESOLVED FIXED    
Severity: normal CC: git
Priority: P3    
Version: 7.1   
Hardware: Macintosh (x86)   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:

Description wjohnsonga 2011-10-12 20:45:45 UTC
In github,create a private github repository and go to project webpage.
Click the SSH button and copy link. e.g. git@github.com:user/Hello.git

In NB:

Select Team>Git>Clone.

Dialog:
Repository URL: git@github.com:user/Hello.git
Choose Private/Public Key
  Private Key File: /Users/user/.ssh/id_rsa
  Passphrase: yadayada

Command fails with response: git@github.com.user/Hello.git: Auth cancel

---
To test connectivity, opened xterm window and repeat with command line:
git clone git@github.com:user/Hello.git

This worked.

---
Also note: private key pathname includes .ssh (usual location) which isn't visible if trying to browse to this file through the Browse option.
Comment 1 Ondrej Vrabec 2011-10-12 20:57:29 UTC
> create a private github repository
and does a public repository work?
Comment 2 wjohnsonga 2011-10-12 22:00:34 UTC
(In reply to comment #1)
> > create a private github repository
> and does a public repository work?

It works with a public repository but no public/private key is required for this case.
Comment 3 Ondrej Vrabec 2011-10-13 07:29:23 UTC
> It works with a public repository but no public/private key is required for
> this case.
Is it? I thought every ssh access to github repositories must be authorized with public/private key pair. That's why i need to know if public repositories (there are two kinds of projects on github - with public and private visibility AFAIK) work. I cannot try your scenario myself, i do not have a paid account on github so i am unable to create a private repository - it's only for paying customers. 
Can you then setup a test repository where i can test it? Create a private repository, add me as a project member (user ovrabec).
Maybe it's a problem with your private key format. If you can, generate a private/public key pair for me on your machine and send it to my email.
Comment 4 Ondrej Vrabec 2011-10-13 08:35:36 UTC
One more question: did you enter also username into the Username field? It's not enough to just enter is as part of the URL. To successfully connect you need to enter: URL, username, private key file and passphrase.
Comment 5 Quality Engineering 2011-10-14 15:03:59 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/19e33a52de8d
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: #203614 - cannot clone private github repository with public/private key
display also hidden files and folders while browsing disk for identity file
Comment 6 Ondrej Vrabec 2011-10-19 12:03:47 UTC
From an extensive e-mail communication with the reporter we found the reason. For github repositories and the ssh protocol (the URL usually looks like git@github.com:REPOSITORY_OWNER/repo.git) it is necessary to enter "git" into the username field not user's actual github username (not even when the user is the owner of the repository).
So the thing we should fix here is that:
1) automatically fill in the username field with 'git'
2) have an example for github clone in the F1 topic (after click on the Help button) and in the user guide probably.

Another related usability problem: when selecting private key file via the file chooser, hidden files were not displayed, so one could not select e.g. ~/.ssh/id_dsa (at least not easily). Fixed in http://hg.netbeans.org/main-golden/rev/19e33a52de8d
Comment 7 Ondrej Vrabec 2011-10-19 14:10:52 UTC
fix: http://hg.netbeans.org/core-main/rev/8087a69bb336
Comment 8 Quality Engineering 2011-10-20 14:24:25 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/8087a69bb336
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: #203614 - cannot clone private github repository with public/private key
fill username field with value from git URL