cargo-generate: Unable to generate new project (ssh issue?)
When trying to generate a new project (on Windows 10, using WSL shell), cargo-generate
errors out while trying to generate a project:
playground $ cargo generate --git https://github.com/cloudflare/worker-template
Project Name: Testing
Renaming project called `Testing` to `testing`...
Creating project called `testing`...
Git Error: failed to clone into: /mnt/c/Users/Kristian Freeman/src/playground/testing6aQq65
(This issue was moved from https://github.com/cloudflare/wrangler/issues/322)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 36
Hi! I’m here following attempting to use Cloudflare wrangler as follows:
After a bit of googling, I found that the issue was related to my
~/.gitconfig
file.I have the following lines (I think from some golang stuff? can’t remember):
Commenting out those two lines fixes the above issue:
referencing https://github.com/rust-lang/cargo/issues/3381 for pointing me in this direction.
hope this helps!
@cj123 Thanks man! I can confirm I use ssh for git, temporarily commented out these line:
Works now… hope it gets fixed!
I also encountered this issue in Win10+WSL2, and found I was able to work around by setting the “git-fetch-with-cli” flag to true https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
seems like this bypasses the libgit library cargo otherwise uses, which may be the issue
I also encountered this issue on macOS Big Sur, and thought I’d post my findings just incase it’s helpful to anyone else.
I found thanks to some other comments above that I did not have any
insteadOf
configuration lines in my .gitconfig, but I did have this line:Which for some reason causes the generate command to break. When I comment out this line the generate command works as expected.
It turned out that I don’t actually have a directory at
~/.git-templates
, so perhaps that’s the root cause of my problem, however I’ve never had an issue usinggit clone
orgit init
with this line present in my config before.FYI for people coming here that your gitconfig might look somewhat differently than shown in https://github.com/ashleygwilliams/cargo-generate/issues/168#issuecomment-537093190
If yours looks like this, temporarily removing or commenting out these similar lines also will workaround it:
I get a similar, though slightly different error on Win10 + WSL2. Didn’t want to add another issue considering how similar it is.
However calling git clone directly works.
I’m just sort of playing around with this windows setup, I’m not very familiar with windows in general.
I checked the WSL2 container’s
.gitconfig
and there are no url rewrites taking place.So is direct clone of the repo enough? What steps could I take, using raw
git clone
as a workaround to proceed? Iscargo generate
doing anything more that git clone would have done?Update: Okay so replacing the
{{project-name}}
and{{authors}}
in the Cargo.toml and then running the build command succeeds. I ran into other node related issues and I’m giving up for now. Hopefully this helps someone else.Yep, it is with WSL! Any other info I can provide to make diagnosing easier?