4

Is it possible to do Git LFS over SSH?

I've read documentation and it seems git only does auth over SSH in LFS push. Here:

they talk about how it is not supported

1
  • 4
    I think that link is out of date. (And it is a 3rd party community forum question, not Git documentation!) According to github.com/git-lfs/git-lfs/blob/main/docs/api/… LFS over SSH can be made to work, but it does require some configuration. Commented Feb 24, 2022 at 1:54

2 Answers 2

6

Brian M. Carlson added full SSH support to git-lfs in version 3.0! So you should be able to upgrade git and the git-lfs plugin and you'll be good to go!

Thank you @mstrap

Sign up to request clarification or add additional context in comments.

2 Comments

This isn't correct anymore as of today: github.com/git-lfs/git-lfs/issues/1044
Thank you! I'll correct my answer.
3

In my experience, git LFS doesn't work to download LFS objects over ssh (i.e. git clone myuser@myserver:path/to/repo.git).

However, git LFS does work with locally-accessible directory-based clones (i.e. git clone /path/to/myrepo or git clone /path/to/bare-repo.git).

One possible solution is to mount the remote repository directory as a folder via, for example SSHFS, or Samba, or WebDAV, or any other networked file system driver. Then all you have to do is git clone it locally into your workspace.

Example using sshfs:

mkdir -p ~/.sshfs-mounts/mydevserver-testrepo
sshfs -o reconnect,idmap=user mydevserver:mygitrepos/testrepo ~/.sshfs-mounts/mydevserver-testrepo
git clone ~/.sshfs-mounts/mydevserver-testrepo ~/workspace/testrepo

Where:

  • mydevserver is your server network name or IP
  • mygitrepos/testrepo is the path relative to your home directory to your repo; ~/mygitrepos/testrepo/.git on the remote server is the repo's git directory.
  • ~/workspace/testrepo is where you want to work on the files

Pushes/LFS "smudges" should work normally.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.