-
-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
When using pkgs.fetchgit with an SSH URL: "error: cannot run ssh: No such file or directory" #195117
Comments
FWIW GitHub and GitLab require SSH public key to be associated with an account, yikes. I’d assume that other Git hosts have the same behavior, so that’s likely the reason why clone over SSH is not supported out-of-the-box. As a workaround, it’s possible to instruct Git to rewrite SSH clone URLs to HTTPS. (fetchFromGitHub {
owner = "…";
repo = "…";
rev = "…";
hash = "…";
fetchSubmodules = true;
}).overrideAttrs (_: {
GIT_CONFIG_COUNT = 1;
GIT_CONFIG_KEY_0 = "url.https://github.com/.insteadOf";
GIT_CONFIG_VALUE_0 = "[email protected]:";
}) cc @gou4shi1 as you’ve also stumbled on this issue recently 🥲 Edit: as mentioned below, this workaround is for Git repositories with submodules that use SSH instead of HTTPS on GitHub/GitLab. It will not work for private repositories. |
@tie It doesn't work for private repository. |
I am able to fetch private repository using ssh:
Preconditions:
|
Just had exactly the same issue as OP. Using |
Encountered the same error while trying to package a Flutter project with pub2nix. If |
I think I'm also hitting the same issue when attempting to package a Rust-based tool that has an ssh://[email protected] URL in its Cargo.lock. Switch to https seems to have solved this for me for now. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/derivations-that-depend-on-git-submodules/48872/2 |
For those hitting this issue using rustPlatform.buildRustPackage {
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
} |
Describe the bug
See title.
Steps To Reproduce
Expected behavior
Nix should be able to fetch the repo.
Additional context
I'm using an SSH url because the repo I'm trying to fetch is private, but this error appears to be reproducible with any SSH url pointing anywhere.
Metadata
The text was updated successfully, but these errors were encountered: