Skip to content

fetchGit fails when trying to fetch from a repository that doesn't have master #1923

Closed
@knedlsepp

Description

@knedlsepp

When trying to fetch a git revision of a repository that doesn't have a master branch, I get the following error

fatal: Couldn't find remote ref master

Example:

cat << EOF | nix repl
builtins.fetchGit {
  url = https://github.com/conradsnicta/armadillo-code;
  rev = "8696c7ef3a7e66e92558b438182b7ee5878f028f";
}
EOF

This can be resolved by additionally specifying the branch which includes the commit as ref:

cat << EOF | nix repl
builtins.fetchGit {
  url = https://github.com/conradsnicta/armadillo-code;
  ref = "unstable";
  rev = "8696c7ef3a7e66e92558b438182b7ee5878f028f";
}
EOF

While the issue itself is solvable via specifying the ref, this behavior is however rather surprising.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions