Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CLI based fetch the default #72

Closed
gitartpiano opened this issue Jul 16, 2020 · 2 comments
Closed

Make CLI based fetch the default #72

gitartpiano opened this issue Jul 16, 2020 · 2 comments
Labels
C-question Category: Question

Comments

@gitartpiano
Copy link

The libgit2 based git operations have some problems (with SSH).
There is a workaround for this problem: setting the CARGO_NET_GIT_FETCH_WITH_CLI environment variable to true.

If the CLI based git access has no known problems, then why not make CLI the default option?
This default could be overwritten by setting the CARGO_NET_GIT_FETCH_WITH_CLI environment variable to false, in case some users don't like the more sensible new default.

@Hirevo
Copy link
Owner

Hirevo commented Jul 17, 2020

By default, Alexandrie already manages its crate index using the git command line utility instead of libgit2, as specified in the default alexandrie.toml file:

[index]
type = "command-line"
path = "crate-index"

The issue with a crate index configured using SSH is that the issue we mentioned arises on the users' machine (the consumers of the libraries hosted by the instance) when they perform cargo build or cargo search.
It is an issue happening outside of Alexandrie's reach.

Fixing the default can only be done within Cargo itself; here is a direct link to the libgit2 authentication handling in Cargo's source code.
This is the piece of code that, reportedly, does not always find the needed credentials to pull/push through SSH.
And by setting CARGO_NET_GIT_FETCH_WITH_CLI, we tell Cargo to not attempt to find the credentials and do things itself, but rather to let the system git utility to sort it out for us.

@Hirevo Hirevo added the C-question Category: Question label Jul 17, 2020
@gitartpiano
Copy link
Author

gitartpiano commented Jul 17, 2020

Your explanations clarified for me.

I have also found out from cargo's https://doc.rust-lang.org/cargo/reference/config.html , that instead of the environment variable CARGO_NET_GIT_FETCH_WITH_CLI, I can also write this

[net]
git-fetch-with-cli = true   # use the `git` executable for git operations

into top level cargo config file:

Windows: %USERPROFILE%\.cargo\config.toml
Unix: $HOME/.cargo/config.toml

Since this is an easy workaround, there is no need for changing any defaults, I changed my mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-question Category: Question
Projects
None yet
Development

No branches or pull requests

2 participants