Git Error: malformed URL ''; class=Net (12); code=InvalidSpec (-12)

Viewed 104

when I running "cargo generate --git https://github.com/rustwasm/wasm-pack-template", the terminal show error "Unable to load config file: /Users/***/.cargo/cargo-generate.toml Error: ⛔ Git Error: malformed URL ''; class=Net (12); code=InvalidSpec (-12)" I has run "cargo install cargo-generate". what's the cause of the?

1 Answers

The first part of the message is more of a warning. One can create an empty $HOME/.cargo/cargo-generate.toml to silence it. The file is described in https://docs.rs/crate/cargo-generate/0.5.1. It appears it is not in the latest version of that documentation.

And I suspect for me the reason this was failing is my ~/.gitconfig has the lines

[url "ssh://git@github.com/"]
    insteadOf = https://github.com/

I didn't want to change my .gitconfig but I found this alternate path to use that makes cargo-generate and git happy.

cargo generate --git git@github.com:rustwasm/wasm-pack-template.git
Related