{"action":"created","comment":{"url":"https://api.github.com/repos/npm/npm/pulls/comments/51695014","id":51695014,"diff_hunk":"@@ -74,40 +85,20 @@ function addRemoteGit (uri, _cb) {\n   }\n }\n \n-function tryGitProto (from, hostedInfo, cb) {\n-  var gitURL = hostedInfo.git()\n-  if (!gitURL) return tryHTTPS(from, hostedInfo, cb)\n-\n-  log.silly('tryGitProto', 'attempting to clone', gitURL)\n-  tryClone(from, gitURL, true, function (er) {\n-    if (er) return tryHTTPS(from, hostedInfo, cb)\n-\n-    cb.apply(this, arguments)\n-  })\n-}\n-\n-function tryHTTPS (from, hostedInfo, cb) {\n-  var httpsURL = hostedInfo.https()\n-  if (!httpsURL) {\n-    return cb(new Error(from + ' can not be cloned via Git, SSH, or HTTPS'))\n+function tryProtos (from, services, previousError, cb) {\n+  if (services.length === 0) {\n+    return cb(previousError ||\n+              new Error(from + ' can not be cloned via HTTPS, SSH or Git'))\n   }\n-\n-  log.silly('tryHTTPS', 'attempting to clone', httpsURL)\n-  tryClone(from, httpsURL, true, function (er) {\n-    if (er) return trySSH(from, hostedInfo, cb)\n-\n+  var service = services.shift()\n+  var silent = (service.protocol !== 'ssh')\n+  log.silly('tryProtos', 'attempting to clone', url)","path":"lib/cache/add-remote-git.js","position":54,"original_position":54,"commit_id":"4c8b4109c8cd1ced4c78131a3023cfbd18af509d","original_commit_id":"4c8b4109c8cd1ced4c78131a3023cfbd18af509d","user":{"login":"gagern","id":190759,"avatar_url":"https://avatars.githubusercontent.com/u/190759?v=3","gravatar_id":"","url":"https://api.github.com/users/gagern","html_url":"https://github.com/gagern","followers_url":"https://api.github.com/users/gagern/followers","following_url":"https://api.github.com/users/gagern/following{/other_user}","gists_url":"https://api.github.com/users/gagern/gists{/gist_id}","starred_url":"https://api.github.com/users/gagern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagern/subscriptions","organizations_url":"https://api.github.com/users/gagern/orgs","repos_url":"https://api.github.com/users/gagern/repos","events_url":"https://api.github.com/users/gagern/events{/privacy}","received_events_url":"https://api.github.com/users/gagern/received_events","type":"User","site_admin":false},"body":"Sure, thanks! I used to have just `url` and `urls` instead of `service` and `services`, but then switched to the latter to write the `silent` flag without having to parse the URL again, and forgot this line. Will amend.","created_at":"2016-02-03T09:11:27Z","updated_at":"2016-02-03T09:11:27Z","html_url":"https://github.com/npm/npm/pull/11248#discussion_r51695014","pull_request_url":"https://api.github.com/repos/npm/npm/pulls/11248","_links":{"self":{"href":"https://api.github.com/repos/npm/npm/pulls/comments/51695014"},"html":{"href":"https://github.com/npm/npm/pull/11248#discussion_r51695014"},"pull_request":{"href":"https://api.github.com/repos/npm/npm/pulls/11248"}}},"pull_request":{"url":"https://api.github.com/repos/npm/npm/pulls/11248","id":56861802,"html_url":"https://github.com/npm/npm/pull/11248","diff_url":"https://github.com/npm/npm/pull/11248.diff","patch_url":"https://github.com/npm/npm/pull/11248.patch","issue_url":"https://api.github.com/repos/npm/npm/issues/11248","number":11248,"state":"open","locked":false,"title":"Change hosted git order to https then ssh then git ","user":{"login":"gagern","id":190759,"avatar_url":"https://avatars.githubusercontent.com/u/190759?v=3","gravatar_id":"","url":"https://api.github.com/users/gagern","html_url":"https://github.com/gagern","followers_url":"https://api.github.com/users/gagern/followers","following_url":"https://api.github.com/users/gagern/following{/other_user}","gists_url":"https://api.github.com/users/gagern/gists{/gist_id}","starred_url":"https://api.github.com/users/gagern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagern/subscriptions","organizations_url":"https://api.github.com/users/gagern/orgs","repos_url":"https://api.github.com/users/gagern/repos","events_url":"https://api.github.com/users/gagern/events{/privacy}","received_events_url":"https://api.github.com/users/gagern/received_events","type":"User","site_admin":false},"body":"This way, authenticated connections are preferred over unauthenticated ones.\r\nThe order is now easier to adjust, since it's just an array.\r\n\r\nThis supersedes #11087 and fixes #9470.\r\n\r\nI'm not sure about the rationale behind the `silent` argument. It used to be `true` for git and https, but `false` for ssh. Is that because ssh is more likely to ask for a password (if `GIT_ASKPASS` is set appropriately), so you want to show the command to go with that? Or is that because ssh was the last protocol to try, so you wanted to show one clone command before giving up? In my commit here I'm assuming the former, but I'm not sure, and the commit message of 6b0f58877f37df9904490ffbaaad33862bd36dce didn't explain. It would be possible to change condition to `services.length !== 0`.","created_at":"2016-01-22T09:02:25Z","updated_at":"2016-02-03T09:11:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4d3d5facfe7304aadc2bdff114f6e305b3bfe2dc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/npm/npm/pulls/11248/commits","review_comments_url":"https://api.github.com/repos/npm/npm/pulls/11248/comments","review_comment_url":"https://api.github.com/repos/npm/npm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/npm/npm/issues/11248/comments","statuses_url":"https://api.github.com/repos/npm/npm/statuses/4c8b4109c8cd1ced4c78131a3023cfbd18af509d","head":{"label":"gagern:gitOrder","ref":"gitOrder","sha":"4c8b4109c8cd1ced4c78131a3023cfbd18af509d","user":{"login":"gagern","id":190759,"avatar_url":"https://avatars.githubusercontent.com/u/190759?v=3","gravatar_id":"","url":"https://api.github.com/users/gagern","html_url":"https://github.com/gagern","followers_url":"https://api.github.com/users/gagern/followers","following_url":"https://api.github.com/users/gagern/following{/other_user}","gists_url":"https://api.github.com/users/gagern/gists{/gist_id}","starred_url":"https://api.github.com/users/gagern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagern/subscriptions","organizations_url":"https://api.github.com/users/gagern/orgs","repos_url":"https://api.github.com/users/gagern/repos","events_url":"https://api.github.com/users/gagern/events{/privacy}","received_events_url":"https://api.github.com/users/gagern/received_events","type":"User","site_admin":false},"repo":{"id":47405594,"name":"npm","full_name":"gagern/npm","owner":{"login":"gagern","id":190759,"avatar_url":"https://avatars.githubusercontent.com/u/190759?v=3","gravatar_id":"","url":"https://api.github.com/users/gagern","html_url":"https://github.com/gagern","followers_url":"https://api.github.com/users/gagern/followers","following_url":"https://api.github.com/users/gagern/following{/other_user}","gists_url":"https://api.github.com/users/gagern/gists{/gist_id}","starred_url":"https://api.github.com/users/gagern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagern/subscriptions","organizations_url":"https://api.github.com/users/gagern/orgs","repos_url":"https://api.github.com/users/gagern/repos","events_url":"https://api.github.com/users/gagern/events{/privacy}","received_events_url":"https://api.github.com/users/gagern/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gagern/npm","description":"a package manager for javascript","fork":true,"url":"https://api.github.com/repos/gagern/npm","forks_url":"https://api.github.com/repos/gagern/npm/forks","keys_url":"https://api.github.com/repos/gagern/npm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gagern/npm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gagern/npm/teams","hooks_url":"https://api.github.com/repos/gagern/npm/hooks","issue_events_url":"https://api.github.com/repos/gagern/npm/issues/events{/number}","events_url":"https://api.github.com/repos/gagern/npm/events","assignees_url":"https://api.github.com/repos/gagern/npm/assignees{/user}","branches_url":"https://api.github.com/repos/gagern/npm/branches{/branch}","tags_url":"https://api.github.com/repos/gagern/npm/tags","blobs_url":"https://api.github.com/repos/gagern/npm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gagern/npm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gagern/npm/git/refs{/sha}","trees_url":"https://api.github.com/repos/gagern/npm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gagern/npm/statuses/{sha}","languages_url":"https://api.github.com/repos/gagern/npm/languages","stargazers_url":"https://api.github.com/repos/gagern/npm/stargazers","contributors_url":"https://api.github.com/repos/gagern/npm/contributors","subscribers_url":"https://api.github.com/repos/gagern/npm/subscribers","subscription_url":"https://api.github.com/repos/gagern/npm/subscription","commits_url":"https://api.github.com/repos/gagern/npm/commits{/sha}","git_commits_url":"https://api.github.com/repos/gagern/npm/git/commits{/sha}","comments_url":"https://api.github.com/repos/gagern/npm/comments{/number}","issue_comment_url":"https://api.github.com/repos/gagern/npm/issues/comments{/number}","contents_url":"https://api.github.com/repos/gagern/npm/contents/{+path}","compare_url":"https://api.github.com/repos/gagern/npm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gagern/npm/merges","archive_url":"https://api.github.com/repos/gagern/npm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gagern/npm/downloads","issues_url":"https://api.github.com/repos/gagern/npm/issues{/number}","pulls_url":"https://api.github.com/repos/gagern/npm/pulls{/number}","milestones_url":"https://api.github.com/repos/gagern/npm/milestones{/number}","notifications_url":"https://api.github.com/repos/gagern/npm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gagern/npm/labels{/name}","releases_url":"https://api.github.com/repos/gagern/npm/releases{/id}","deployments_url":"https://api.github.com/repos/gagern/npm/deployments","created_at":"2015-12-04T13:27:39Z","updated_at":"2015-12-04T13:27:45Z","pushed_at":"2016-01-25T10:52:53Z","git_url":"git://github.com/gagern/npm.git","ssh_url":"git@github.com:gagern/npm.git","clone_url":"https://github.com/gagern/npm.git","svn_url":"https://github.com/gagern/npm","homepage":"http://www.npmjs.com/","size":26183,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"npm:master","ref":"master","sha":"82be147fcf0bdd047c30926faa69b01c4d4d40e3","user":{"login":"npm","id":6078720,"avatar_url":"https://avatars.githubusercontent.com/u/6078720?v=3","gravatar_id":"","url":"https://api.github.com/users/npm","html_url":"https://github.com/npm","followers_url":"https://api.github.com/users/npm/followers","following_url":"https://api.github.com/users/npm/following{/other_user}","gists_url":"https://api.github.com/users/npm/gists{/gist_id}","starred_url":"https://api.github.com/users/npm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npm/subscriptions","organizations_url":"https://api.github.com/users/npm/orgs","repos_url":"https://api.github.com/users/npm/repos","events_url":"https://api.github.com/users/npm/events{/privacy}","received_events_url":"https://api.github.com/users/npm/received_events","type":"Organization","site_admin":false},"repo":{"id":321278,"name":"npm","full_name":"npm/npm","owner":{"login":"npm","id":6078720,"avatar_url":"https://avatars.githubusercontent.com/u/6078720?v=3","gravatar_id":"","url":"https://api.github.com/users/npm","html_url":"https://github.com/npm","followers_url":"https://api.github.com/users/npm/followers","following_url":"https://api.github.com/users/npm/following{/other_user}","gists_url":"https://api.github.com/users/npm/gists{/gist_id}","starred_url":"https://api.github.com/users/npm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npm/subscriptions","organizations_url":"https://api.github.com/users/npm/orgs","repos_url":"https://api.github.com/users/npm/repos","events_url":"https://api.github.com/users/npm/events{/privacy}","received_events_url":"https://api.github.com/users/npm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/npm/npm","description":"a package manager for javascript","fork":false,"url":"https://api.github.com/repos/npm/npm","forks_url":"https://api.github.com/repos/npm/npm/forks","keys_url":"https://api.github.com/repos/npm/npm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/npm/npm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/npm/npm/teams","hooks_url":"https://api.github.com/repos/npm/npm/hooks","issue_events_url":"https://api.github.com/repos/npm/npm/issues/events{/number}","events_url":"https://api.github.com/repos/npm/npm/events","assignees_url":"https://api.github.com/repos/npm/npm/assignees{/user}","branches_url":"https://api.github.com/repos/npm/npm/branches{/branch}","tags_url":"https://api.github.com/repos/npm/npm/tags","blobs_url":"https://api.github.com/repos/npm/npm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/npm/npm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/npm/npm/git/refs{/sha}","trees_url":"https://api.github.com/repos/npm/npm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/npm/npm/statuses/{sha}","languages_url":"https://api.github.com/repos/npm/npm/languages","stargazers_url":"https://api.github.com/repos/npm/npm/stargazers","contributors_url":"https://api.github.com/repos/npm/npm/contributors","subscribers_url":"https://api.github.com/repos/npm/npm/subscribers","subscription_url":"https://api.github.com/repos/npm/npm/subscription","commits_url":"https://api.github.com/repos/npm/npm/commits{/sha}","git_commits_url":"https://api.github.com/repos/npm/npm/git/commits{/sha}","comments_url":"https://api.github.com/repos/npm/npm/comments{/number}","issue_comment_url":"https://api.github.com/repos/npm/npm/issues/comments{/number}","contents_url":"https://api.github.com/repos/npm/npm/contents/{+path}","compare_url":"https://api.github.com/repos/npm/npm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/npm/npm/merges","archive_url":"https://api.github.com/repos/npm/npm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/npm/npm/downloads","issues_url":"https://api.github.com/repos/npm/npm/issues{/number}","pulls_url":"https://api.github.com/repos/npm/npm/pulls{/number}","milestones_url":"https://api.github.com/repos/npm/npm/milestones{/number}","notifications_url":"https://api.github.com/repos/npm/npm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/npm/npm/labels{/name}","releases_url":"https://api.github.com/repos/npm/npm/releases{/id}","deployments_url":"https://api.github.com/repos/npm/npm/deployments","created_at":"2009-09-29T17:21:24Z","updated_at":"2016-02-03T08:47:40Z","pushed_at":"2016-02-03T09:08:20Z","git_url":"git://github.com/npm/npm.git","ssh_url":"git@github.com:npm/npm.git","clone_url":"https://github.com/npm/npm.git","svn_url":"https://github.com/npm/npm","homepage":"http://www.npmjs.com/","size":30822,"stargazers_count":8472,"watchers_count":8472,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1716,"mirror_url":null,"open_issues_count":1886,"forks":1716,"open_issues":1886,"watchers":8472,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/npm/npm/pulls/11248"},"html":{"href":"https://github.com/npm/npm/pull/11248"},"issue":{"href":"https://api.github.com/repos/npm/npm/issues/11248"},"comments":{"href":"https://api.github.com/repos/npm/npm/issues/11248/comments"},"review_comments":{"href":"https://api.github.com/repos/npm/npm/pulls/11248/comments"},"review_comment":{"href":"https://api.github.com/repos/npm/npm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/npm/npm/pulls/11248/commits"},"statuses":{"href":"https://api.github.com/repos/npm/npm/statuses/4c8b4109c8cd1ced4c78131a3023cfbd18af509d"}}}}