foundry: Forge install errors on git ssh urls

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.1.0 (1e1583b 2022-03-13T00:03:29.280028909+00:00)

What command(s) is the bug in?

forge install

Operating System

Linux

Describe the bug

This is a minor issue as users can install via Username/Repository fine. This is to support Ctrl + C, Ctrl + V of the repo install URL as a valid source for forge install. This could be seen as a good first issue, minor polishing task.

Here is an example install via ssh-git url that fails:

oliver ~> forge install git@github.com:Rari-Capital/solmate.git
Installing git in "/home/oliver/ghq/github.com/OliverNChalk/custody-vault/lib/git", (url: https://github.com/git, tag: Some("github.com:Rari-Capital/solmate.git"))
Error:
   0: No such file or directory (os error 2)

Location:
   cli/src/cmd/install.rs:157

Backtrace omitted.
Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (19 by maintainers)

Most upvoted comments

We should support it, but would generally suggest not using SSH URLs for submodules since not everyone is using SSH with git and the modules would fail to pull

@sambacha not sure how that would help.

I’m talking about github actions, but converting ssh to https in #1311 (files) breaking the submodule setup for ppl using ssh. Would be nice if I could configure a project to always use ssh as for our team #924 (comment) is the default making https a bit cumbersome.

Or if not via a setting might make sense to just persists the version ppl install (if i install via ssh url i want the ssh url) if that makes sense.

edit: breaking as in “not picking it up automatically” - nothing is actually “broken”

Using that action lets you use ssh like a normal user, you could setup your env that way. It uses your github account’s public key to auth, so you could access any repo you have access to using your github token

GitHub only recognizes the git user otherwise from actions workflow. you could maybe do something like this where your setting the git submodules remote’s to use your github token to auth

ssh://token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ git.submodule }}

then if needed you can replace the normal submodule remotes with the token-based one. here is an example replacing http with https

git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader

Open a new issue as this is closed

Having https over ssh is quite annoying(when working with private repos), any chance we could add a flag to allow ssh over https?