Skip to content

git lfs inputs don't work when ssh is not listening on the default port #13337

@ChrisOboe

Description

@ChrisOboe

Describe the bug

Everthing works fine with e.g. the following input

inputs = {
  bla = {
    url = "ssh://myuser@myserver/username/reponame.git";
    type = "git";
    ref = "main";
    flake = false;
    lfs = true;
  }
};

but it breaks with the following

inputs = {
  bla = {
    url = "ssh://myuser@myserver:3022/username/reponame.git";
    type = "git";
    ref = "main";
    flake = false;
    lfs = true;
  }
};
ssh: Could not resolve hostname myserver:3022: Name or service not known
error:
       … while updating the lock file of flake 'path:/mypath?lastModified=1749391096&narHash=sha256-WzaUJw3/ORsoa7QfNaZT0ja/5wngsVXaSUfgw/Y7ImM%3D'

       … while updating the flake input 'bla'

       … while smudging git-lfs file '/myfile'

       error: git-lfs-authenticate: no output (cmd: ssh myser@myserver:3022 git-lfs-authenticate /username/reponame.git download)

it seems to me the command is wrong.

it should have used ssh myser@myserver -p3022 git-lfs-authenticate /username/reponame.git download instead .

cloning from ssh://myuser@myserver:3022/username/reponame.git and doing a git lfs pull manually works just fine. so i think it's a nix specific problem and not a git-lfs one.

Steps To Reproduce

Set up a git server with lfs support and let ssh listen on a port other than 22.
Create a repo, add some lfs objects. try to use it in a flake via ssh.

Expected behavior

That it fetches the lfs objects

Metadata

nix-env (Nix) 2.28.3

Additional context

Two workarrounds that come to mind is using a different protocol or using the default ssh port.

But both workarrounds aren't possible in my case since the repo is private and i authenticate with my ssh-agent. With http repos something like this afaik isn't possible (and i don't want to hardcode credentials in the url).
And i can't switch my ssh port (at least not easily) since on port 22 already listens my systems ssh, and the 3022 is the ssh server from forgejo.

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions