Skip to content

GitLFS does not respect Git URL rewrites #2298

Closed

Description

@larsxschneider

git lfs seems not to respect Git URL rewrites via Git insteadof config.

Environment

Git LFS 2.1.1 on Windows (Git 2.11.3) and OSX (2.13.0)

Steps to reproduce

  1. Add URL rewrites to your global .gitconfig. E.g.:
[url "https://github.com/"]
    insteadOf = ssh://[email protected]:
    insteadOf = ssh://[email protected]:/
    insteadOf = [email protected]:
    insteadOf = [email protected]:/
  1. Remove your SSH key on GitHub if you have one

  2. Clone any LFS repo via SSH:

GIT_SSH_COMMAND="ssh -vvv" GIT_CURL_VERBOSE=1 git lfs clone [email protected]:any-org/any-repo.git

The Git clone operation is performed via HTTPS but Git LFS tries to use SSH for the rest of the work (noticeable by the debug SSH statements).

Activity

  1. technoweenie commented on Jun 6, 2017

    @technoweenie
    Contributor

    Looks like support was added in #1443. I wonder if LFS is doing the replacement at the wrong spot, so it's not affecting ssh urls?

  2. technoweenie commented on Jun 6, 2017

    @technoweenie
    Contributor

    Another possible cause is multiple config lines: /cc #864 (comment)

  3. tardyp commented on Aug 20, 2018

    @tardyp

    Looks like indeed, there is a problem with parsing the gitconfig

    [url "http://mirror/"]
        insteadOf = https://cloudserver/
        insteadOf = git@cloudserver:
    

    does not work

    [url "http://mirror/"]
        insteadOf = git@cloudserver:
        insteadOf = https://cloudserver/
    

    works..

    git remote -v produce correct results in both case
    git lfs env does not.

  4. duaneellissd commented on Nov 6, 2018

    @duaneellissd

    Confirm - Painful for me :-( I wish this was fixed.
    Cannot recrusively clone git lfs enabled repos
    Top level is not git - lfs, but sub-levels are
    And insteadof is set in my global config
    mapping https//bitbucket.org -> SSH access.

  5. reefbarman commented on Feb 7, 2019

    @reefbarman

    I believe I am seeing similar issues to @tardyp and @duaneellissd. Was there a fix for this or a workaround?

  6. bk2204 commented on Feb 7, 2019

    @bk2204
    Member

    I think currently we don't support multiple insteadOf aliases. We probably should, though.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions