git lfs with ssh #1048

Closed
opened 2025-11-02 03:46:31 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @laoshaw on GitHub (Sep 8, 2017).

To get git-lfs working with ssh/scp it can be redirected to http/https as native ssh support is not implemented upstream, below is related info:

https://github.com/git-lfs/git-lfs/blob/master/docs/custom-transfers.md#using-a-custom-transfer-type-without-the-api-server

https://github.com/git-lfs/git-lfs/issues/1044

Originally created by @laoshaw on GitHub (Sep 8, 2017). To get git-lfs working with ssh/scp it can be redirected to http/https as native ssh support is not implemented upstream, below is related info: https://github.com/git-lfs/git-lfs/blob/master/docs/custom-transfers.md#using-a-custom-transfer-type-without-the-api-server https://github.com/git-lfs/git-lfs/issues/1044
GiteaMirror added the type/featureissue/confirmedtype/enhancement labels 2025-11-02 03:46:31 -06:00
Author
Owner

@bkcsoft commented on GitHub (Sep 8, 2017):

Those transfer-hooks are client-side so we can't make that happen unfortunately. Only way to get real SSH-support is to get it upstream in the issue you linked :(

@bkcsoft commented on GitHub (Sep 8, 2017): Those transfer-hooks are client-side so we can't make that happen unfortunately. Only way to get real SSH-support is to get it upstream in the issue you linked :(
Author
Owner

@bkcsoft commented on GitHub (Sep 8, 2017):

The only solution today is to have SSH return a JSON-payload for redirecting it to HTTP(S) https://github.com/git-lfs/git-lfs/issues/1044#issuecomment-188893647 which is fairly straight forward to add:

@bkcsoft commented on GitHub (Sep 8, 2017): The only solution today is to have SSH return a JSON-payload for redirecting it to HTTP(S) https://github.com/git-lfs/git-lfs/issues/1044#issuecomment-188893647 which is fairly straight forward to add: - If the command is `git-lfs-authenticate` https://gitlab.com/gitlab-org/gitlab-shell/blob/master/lib/gitlab_shell.rb#L121-126 - Verify user permissions: https://gitlab.com/gitlab-org/gitlab-shell/blob/master/lib/gitlab_shell.rb#L214-220 - And return the payload: https://gitlab.com/gitlab-org/gitlab-shell/blob/master/lib/gitlab_lfs_authentication.rb
Author
Owner

@stale[bot] commented on GitHub (Feb 13, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Feb 13, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@ukos-git commented on GitHub (Feb 27, 2019):

I can not get ssh authentification to work so I guess this is still an open issue

I don't know where to start for the solution proposed by @bkcsoft .
b03d780ccb/cmd/serv.go (L137-L147)

Can you look again at ssh authentification for lfs in gitea @fabian-z @lunny

@ukos-git commented on GitHub (Feb 27, 2019): I can not get ssh authentification to work so I guess this is still an open issue I don't know where to start for the solution proposed by @bkcsoft . https://github.com/go-gitea/gitea/blob/b03d780ccb9e7c1926c13b88180512b491858d48/cmd/serv.go#L137-L147 Can you look again at ssh authentification for lfs in gitea @fabian-z @lunny
Author
Owner

@fabian-z commented on GitHub (Feb 27, 2019):

Well, we should already be doing what @bkcsoft suggested and it worked in my original tests.

This code is responsible for implementing server discovery by returning the proper URL and authentication token if called via SSH: b03d780ccb/cmd/serv.go (L292-L326)

It seems there is some confusion about the subject of this issue.

One aspect is server discovery / authentication using SSH. This should be implemented and working according to the LFS API docs.

Another one is transfer of data with SSH instead of HTTPS. This is currently not part of the LFS specification and therefore also not implemented, still to be decided upstream (see https://github.com/git-lfs/git-lfs/issues/1044)

@ukos-git: Could you elaborate on what part of SSH authentication is not working for you? What did you do, what errors are you getting? Please make sure your server has a working HTTPS configuration.

@laoshaw: Are you only asking for a pure SSH based transport without HTTPS (as in the linked git-lfs issue)? Do you experience issues when using SSH remotes? Please also make sure your server has a working HTTPS configuration.

@fabian-z commented on GitHub (Feb 27, 2019): Well, we should already be doing what @bkcsoft suggested and it worked in my original tests. This code is responsible for implementing server discovery by returning the proper URL and authentication token if called via SSH: https://github.com/go-gitea/gitea/blob/b03d780ccb9e7c1926c13b88180512b491858d48/cmd/serv.go#L292-L326 It seems there is some confusion about the subject of this issue. One aspect is server discovery / authentication using SSH. This should be implemented and working according to the LFS API docs. Another one is transfer of data with SSH instead of HTTPS. This is currently not part of the LFS specification and therefore also not implemented, still to be decided upstream (see https://github.com/git-lfs/git-lfs/issues/1044) @ukos-git: Could you elaborate on what part of SSH authentication is not working for you? What did you do, what errors are you getting? Please make sure your server has a working HTTPS configuration. @laoshaw: Are you only asking for a pure SSH based transport without HTTPS (as in the linked git-lfs issue)? Do you experience issues when using SSH remotes? Please also make sure your server has a working HTTPS configuration.
Author
Owner

@ukos-git commented on GitHub (Feb 27, 2019):

Authentification is working now.

ssh ssh://git@mygitproject git-lfs-authenticate user/repo download
{
  "header": {
    "Authorization": "Bearer XYZ"
  },
  "href": "https://mygitproject/user/repo.git/info/lfs"
}

I got probably confused during the setup.

Since the gitea implementation is actually working, we should close this issue here. implementation of scp is an upstream git-lfs problem.

@ukos-git commented on GitHub (Feb 27, 2019): Authentification is working now. ```bash ssh ssh://git@mygitproject git-lfs-authenticate user/repo download ``` ```json { "header": { "Authorization": "Bearer XYZ" }, "href": "https://mygitproject/user/repo.git/info/lfs" } ``` I got probably confused during the setup. Since the gitea implementation is actually working, we should close this issue here. implementation of scp is an upstream git-lfs problem.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1048