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
docs: Add some examples to fetchGit #2384
Conversation
417c68e
to
2df21b7
Compare
doc/manual/expressions/builtins.xml
Outdated
clone</command>. <function>builtins.fetchGit</function> uses | ||
a <literal>/</literal> instead of a <literal>:</literal> | ||
between <literal>github.com</literal> and | ||
<literal>my-secret</literal>.</para></note> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that? I'm not aware that we rewrite Git URLs anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the explanation is not totally correct, but:
detected as a directory:
nix-repl> builtins.fetchGit { url = "git@github.com:grahamc/nixos-config.git"; ref = "master"; }
fetching Git repository '/home/grahamc/git@github.com:grahamc/nixos-config.git'fatal: '/home/grahamc/git@github.com:grahamc/nixos-config.git' does not appear to be a git repository
fatal: Could not read from remote repository.
confused hostname:
nix-repl> builtins.fetchGit { url = "ssh://git@github.com:grahamc/nixos-config.git"; ref = "master"; }
fetching Git repository 'ssh://git@github.com:grahamc/nixos-config.git'ssh: Could not resolve hostname github.com:grahamc: Name or service not known
fatal: Could not read from remote repository.
just right:
nix-repl> builtins.fetchGit { url = "ssh://git@github.com/grahamc/nixos-config.git"; ref = "master"; }
{ outPath = "/nix/store/bf5xjh16pcgxk2lj4frmby26740q10wg-source"; rev = "0524294c41343b7c400ddc1d7442dc6bde308f95"; revCount = 66; shortRev = "0524294"; }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first one is a bug which I just fixed (475a0a5). The second one is not valid Git syntax I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are confusing ssh://git@github.com/NixOS/nix.git
with git@github.com:NixOS/nix.git
, the second format isn't supported in nix since that's not a uri.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
I found a bug - #2385 as part of writing this, but it shouldn't block these docs.
Ideally these would be backported.
Rendered: