new_git_repository & SSH Keys

954 views
Skip to first unread message

Pranav Sathyanarayanan

unread,
Nov 11, 2016, 2:46:17 PM11/11/16
to bazel-...@googlegroups.com
Hi,

I know it is explicitly stated in the documentation that the remote attribute of the new_git_repository does not suppoer authentication, but I was wondering if there is any upcoming support / slated support for authentication for it. I have a private git repo, and I have my SSH keys configured for cloning which work if I just git clone myself, but Bazel fails.

- Pranav S.

Nelson Elhage

unread,
Nov 11, 2016, 2:53:57 PM11/11/16
to Pranav Sathyanarayanan, bazel-discuss
Hi Pranav,

They're currently undocumented and last I checked we were waiting on
better test harnesses for repository rules to make them public-facing,
but I landed a change a while back to support `new_git_repository`
rules using the git command itself, which lets you support whatever
authentication mechanisms you do already:
https://bazel-review.googlesource.com/#/c/3982/

You should be able to get at them via something like

load("@bazel_tools//tools/build_defs/repo:git_repositories.bzl",
"new_git_repository", "git_repository")

- Nelson
> --
> You received this message because you are subscribed to the Google Groups
> "bazel-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to bazel-discus...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bazel-discuss/CAKM-Mwod_-o8U2qBDeW6t6EaF8yP6qQF3SnS1BY3%2Bq7uYa9C2g%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

Pranav Sathyanarayanan

unread,
Nov 11, 2016, 4:05:24 PM11/11/16
to Nelson Elhage, bazel-discuss
https://www.bazel.io/versions/master/docs/be/workspace.html#new_git_repository

^ This is already a rule it seems, this is what I tried to utilize to pull a private repository but it failed even though I had my git client configured with SSH keys.

Nelson Elhage

unread,
Nov 11, 2016, 4:07:51 PM11/11/16
to Pranav Sathyanarayanan, bazel-discuss
The built-in rule uses a JGit-based implementation and doesn't support
authentication. If you pull in the `git`-binary-based rules from the
location I mentioned, you should get a version that shells out to git
and supports everything the real git client does.

- Nelson

On Fri, Nov 11, 2016 at 4:05 PM, 'Pranav Sathyanarayanan' via
> https://groups.google.com/d/msgid/bazel-discuss/CAKM-MwrPHN9HCH2KDfoqiZpSH%3DULswCg0ofb4fOz5F_CSH3V2Q%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages