Skip to content

Using SSH shorthands as git remote should work the same as a full hostname #278

Closed

Description

@quinox

git-lfs behaves differently when you use an SSH shorthand vs. a full hostname as your git remote, even if they log in over SSH in the same way.

When I use an SSH shorthand I can't get git-lfs to upload binary files, whereas it works just fine when I use the full hostname definition. Looking at the gitolite log everything seems identical except the fact that git-lfs never runs git-lfs-authenticate when using a shorthand notation.

My SSH config:

host ytec
    user git
    hostname odin.ytec.nl

Uploading with a shorthand:

$ git remote -v
origin  ytec:testing (fetch)
origin  ytec:testing (push)

$ git push --set-upstream origin master                                                                                                                                        
(0 of 1 files) 0 B / 1.29 MB  0.00 %
Username for '://':

Uploading without a shorthand:

$ git remote -v
origin  [email protected]:testing (fetch)
origin  [email protected]:testing (push)

$ git push --set-upstream origin master
(1 of 1 files) 1.29 MB / 1.29 MB  100.00 %
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 390 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To [email protected]:testing
   6b58b09..0898ce1  master -> master
Branch master set up to track remote branch master from origin.

Normal git works just fine fine with shorthands:

quinox@duivenkracht:~/projects/testing_manual ^2 $ git ls-remote ssh://[email protected]/testing
0898ce13a2d0c4bd51a16fce42cbc0cce3d38661        HEAD

quinox@duivenkracht:~/projects/testing_manual ^2 $ git ls-remote ssh://ytec/testing            
0898ce13a2d0c4bd51a16fce42cbc0cce3d38661        HEAD

Activity

  1. technoweenie commented on May 4, 2015

    @technoweenie
    Contributor

    Thanks for the bug report.

  2. aorjoa commented on Jun 21, 2015

    @aorjoa
    Contributor

    I try to use SSH shorthand with commit b351a8b and I found it WORK! by following instuction
    file ~/.ssh/config contain this

    host testlfsgithub
        hostname github.com
        user git
    

    this my git repository setting

    $ git remote -v
    testlfsgithub   testlfsgithub:AorJoa/test_git_lfs_repo.git (fetch)
    testlfsgithub   testlfsgithub:AorJoa/test_git_lfs_repo.git (push)
    

    and when I push

    $ git push testlfsgithub master
    (0 of 1 files) 0 B                                                                                                                    
    Username for 'https://127.0.0.1:8080': aorjoa
    Password for 'https://[email protected]:8080': 
    Username for 'https://127.0.0.1:8080': aorjoa
    Password for 'https://[email protected]:8080': 
    (1 of 1 files) 528.15 KB 12s                                                                                                                                
    Counting objects: 3, done.
    Delta compression using up to 2 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 365 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    To testlfsgithub:AorJoa/test_git_lfs_repo.git
       123d2f1..6a9a782  master -> master
    

    Could you try? @quinox

  3. added
    help-wanted
    on Sep 4, 2015
  4. aorjoa commented on Sep 29, 2015

    @aorjoa
    Contributor

    Anybody who can re-produce please ping me.

  5. technoweenie commented on Aug 11, 2016

    @technoweenie
    Contributor

    Closing and moving to the roadmap

  6. technoweenie commented on Dec 1, 2016

    @technoweenie
    Contributor

    Re-opening after adding this to a GH Project.

  7. AdamBryantSkybox commented on Sep 25, 2017

    @AdamBryantSkybox

    Still a problem, ran into it after needing to specify a set of host/hostname.

    Edit: adding (git) to become: git@shorthand:giturl.git works.

  8. ttaylorr commented on Jul 27, 2018

    @ttaylorr
    Contributor

    Hi, re-reading this issue, it looks like what we need to do is read and support $HOME/.ssh/config, as Git does. I moved discussion from #2255 to here, which is a similar issue.

    @PastelMobileSuit do you have time to work on this? I think it'd be a good candidate for v2.6.0.

  9. added this to the v2.6.0 milestone on Jul 27, 2018
  10. self-assigned this
    on Sep 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bughelp-wanted

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions