Skip to content
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

Merged
merged 2 commits into from Sep 1, 2018

Conversation

graham-at-target
Copy link
Contributor

@graham-at-target graham-at-target commented Aug 31, 2018

I found a bug - #2385 as part of writing this, but it shouldn't block these docs.

Ideally these would be backported.

Rendered:

image

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>
Copy link
Member

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.

Copy link
Member

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"; }

Copy link
Member

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.

Copy link
Member

@LnL7 LnL7 Aug 31, 2018

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

@edolstra edolstra merged commit 6ed4a6b into NixOS:master Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants