{"action":"closed","issue":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/853","repository_url":"https://api.github.com/repos/bazelbuild/bazel","labels_url":"https://api.github.com/repos/bazelbuild/bazel/issues/853/labels{/name}","comments_url":"https://api.github.com/repos/bazelbuild/bazel/issues/853/comments","events_url":"https://api.github.com/repos/bazelbuild/bazel/issues/853/events","html_url":"https://github.com/bazelbuild/bazel/issues/853","id":131604470,"number":853,"title":"Git repository cloning error: \"cannot open git-upload-pack\"","user":{"login":"ivant","id":15138,"avatar_url":"https://avatars.githubusercontent.com/u/15138?v=3","gravatar_id":"","url":"https://api.github.com/users/ivant","html_url":"https://github.com/ivant","followers_url":"https://api.github.com/users/ivant/followers","following_url":"https://api.github.com/users/ivant/following{/other_user}","gists_url":"https://api.github.com/users/ivant/gists{/gist_id}","starred_url":"https://api.github.com/users/ivant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivant/subscriptions","organizations_url":"https://api.github.com/users/ivant/orgs","repos_url":"https://api.github.com/users/ivant/repos","events_url":"https://api.github.com/users/ivant/events{/privacy}","received_events_url":"https://api.github.com/users/ivant/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-05T10:14:13Z","updated_at":"2016-02-05T10:14:52Z","closed_at":"2016-02-05T10:14:52Z","body":"This is not directly a Bazel problem, however since it happens when running Bazel on relatively generic machine setup that should be supported (Ubuntu 15.04, OpenJDK 1.8.0_45), and since there's little information on how to debug and fix properly, I'm documenting it here:\r\n\r\nWhen I tried to start using Closure library build rules, I got the following error:\r\n\r\n```\r\nERROR: /home/ivan/foo/BUILD:10:1: no such package '@closure_library//': Error cloning repository: https://github.com/google/closure-library.git: cannot open git\r\n-upload-pack and referenced by '//foo:foo_lib'.\r\n```\r\n\r\nThe string `cannot open git-upload-pack` seems to be connected with network connectivity problems, often related to going through proxy, etc. However in my case I knew that I'm not going through a proxy.\r\n\r\nUnfortunately, JGit-related error reporting in GitCloner.java does not let one see the root causes (which are hidden in the long Java stack trace).\r\n\r\nTo debug this, follow [the instructions to patch GitCloner.java][git-cloner-patch], rebuild Bazel, try to build your target again. This time you'll get a long stack trace which hopefully would provide some clues. In my case it showed\r\n\r\n```\r\nCaused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty\r\n```\r\n\r\nThis is often associated with some problem with Java certificate store.\r\n\r\nThe solution in my case was to do the following:\r\n\r\n```sh\r\nsudo apt-get update ca-certificates-java\r\nsudo update-ca-certificates -f\r\n```\r\n\r\n[git-cloner-patch]: https://groups.google.com/d/msg/bazel-discuss/Mc2I8obVvyw/JU2tnv2mBAAJ"}}