Skip to content

Issue running example code and using in project #14

@scizzorz

Description

@scizzorz

Hello!

I was really struggling to understand the git2 callbacks for authentication and how I can make them behave the same way the standard git binary behaves out of the box, so this library seems extremely promising to me. Unfortunately, I've cloned the repo and tried to run the example, but it doesn't seem to work.

» cargo run --example clone -- --nocapture
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/examples/clone --nocapture`
Error: Error { code: -1, klass: 12, message: "unsupported URL protocol" }

Modifying the git2 dependency to not disable the default features yields a different error message:

diff --git a/Cargo.toml b/Cargo.toml
index c852..7254 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@ exclude = ["/.github", ".dependabot/", "/docs/**", "/scripts", ".gitignore", "/t

 [dependencies]
 dirs = "2.0"
-git2 = { version = "^0.13", default-features = false }
+git2 = { version = "^0.13"}
 dialoguer = { version = "0.6.2", optional = true }
» cargo run --example clone -- --nocapture
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/examples/clone --nocapture`
Error: Error { code: -1, klass: 23, message: "error authenticating: no auth sock variable" }

This same error pops up when I try to use this library in the project I'd actually like to use it in, so it stretches beyond just the example not working. I see in #9 and in https://github.com/davidB/git2_credentials/blob/master/src/ssh_config.rs#L9 that SSH keys should be supported, but I don't know how to enable them.

If there's some gitconfig setting that I need to update, that might be helpful to know, but I would like to know more information about how and why git itself doesn't require that setting to work as I expect.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions