Skip to content

sapling does not handle scp-style git origin path relative to homedir #1480

Open

Description

@mhorowitz

If I clone a git project which is in my homedir on a remote machine:

$ git clone git.example.org:.git-projects/foo.git
$ cd foo
$ git remote -v
origin  git.example.org:.git-projects/foo.git (fetch)
origin  git.example.org:.git-projects/foo.git (push)

Then sl tracking of the git config creates a default path in .git/sl/config-git-repo like this:

[paths]
# from git config: remote.origin.url
default = ssh://git.example.org/.git-projects/foo.git

But this URL doesn't work:

$ sl pull
pulling from ssh://git.example.org/.git-projects/foo.git
abort: git command failed with exit code 128
  git '--git-dir=/home/marc/foo/.git' ls-remote --refs 'ssh://git.example.org/.git-projects/foo.git' refs/heads/main refs/heads/master

    fatal: '/.git-projects/foo.git' does not appear to be a git repository
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

If I update the remote to use a URL form with a ~, then sl works:

$ git remote set-url origin ssh://git.example.org/~/.git-projects/foo.git
$ sl pull
pulling from ssh://git.example.org/~/.git-projects/foo.git

But I shouldn't need to do this. sapling should understand the scp-style origin form.

Activity

  1. rafafaruque commented on Nov 3, 2026

    @rafafaruque

    hey! i'd love to work on this issue. i was able to reproduce the incorrect URL translation locally on macOS with Sapling 0.2.20261028.

    i've been investigating translate_scp_url_to_ssh() in gitcompat/src/config.rs. It looks like the conversion changes the semantics of home-relative SSH paths.

    one possible approach is to preserve the original scp-style URL when passing it to Git, but that would also require updating Sapling's URL recognition and configuration handling. Simply inserting /~/ seems potentially problematic for GitHub-style remotes.

    would preserving the original scp-style URL be the preferred direction, or is there a reason Sapling needs to normalize these into ssh:// URLs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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