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

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?



Solution 1:[1]

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://[email protected]/"]
    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 [email protected]:rustwasm/wasm-pack-template.git

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 WeakPointer