Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The reported lfs.url is not completely honoured when lfs fetch fails #5354

Open
eduardoalvarenga opened this issue Apr 28, 2023 · 1 comment
Labels

Comments

@eduardoalvarenga
Copy link

eduardoalvarenga commented Apr 28, 2023

Describe the bug
When fetching LFS objects from an HTTP endpoint that doesn't match the same address as the SSH URL fails, git-lfs will report a failed fetch to https://SSH URL instead of https://LFS URL.

This is a common issue with Atlassian Bamboo. Bamboo uses an internal Apache MINA SSHD (SSH-PROXY) service to proxy the authentication to a repository. That SSH-PROXY runs on 127.0.0.1. Whenever an LFS fetch issue happens, the git logs will show a failed connection to https://127.0.0.1:xxxxx instead of the remote LFS URL.

To Reproduce

  1. Create an LFS-enabled repository

  2. Shutdown or block the HTTP server (we want it to fail to fetch)

  3. Clone it using an SSH URL and force an IP address (so we will be specifying an "internal" SSH server that does not match the HTTP URL)
    git clone ssh://[email protected]:7999/big/bigfiles.git

  4. Keep the HTTP server down and run git lfs fetch origin

  5. Observe the error message

fetch: Fetching reference refs/heads/master
batch response: Post "https://bitbucket721.osalva.net/scm/big/bigfiles.git/info/lfs/objects/batch": dial tcp 10.0.9.7:443: connect: connection refused                                                        
error: failed to fetch some objects from 'https://10.0.9.7/big/bigfiles.git/info/lfs'

Expected behavior
Git should report the LFS URL reported by the server it is trying to fetch and not the remote (SSH) URL:

error: failed to fetch some objects from 'https://bitbucket721.osalva.net/big/bigfiles.git/info/lfs'

System environment

  • Tested on Bitbucket server, will probably occur on other Git repositories as well

Output of git lfs env

git-lfs/2.13.3 (GitHub; linux amd64; go 1.17.7)
git version 2.31.1

Endpoint=https://10.0.9.7/big/bigfiles.git/info/lfs (auth=none)
  [email protected]:big/bigfiles.git
LocalWorkingDir=/root/bigfiles
LocalGitDir=/root/bigfiles/.git
LocalGitStorageDir=/root/bigfiles/.git
LocalMediaDir=/root/bigfiles/.git/lfs/objects
LocalReferenceDirs=
TempDir=/root/bigfiles/.git/lfs/tmp
ConcurrentTransfers=8
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=/root/bigfiles/.git/lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic,lfs-standalone-file
UploadTransfers=basic,lfs-standalone-file
GIT_EXEC_PATH=/usr/libexec/git-core
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"

Additional context
There's been some work here #3469 and here #3470 that can be extended

@bk2204
Copy link
Member

bk2204 commented Apr 28, 2023

Hey,

I agree this is probably not working the way it should, and we can look into fixing it. However, it's not trivial because the API client which is being used for fetching is deep inside another structure and this message is printed at a higher level. Therefore, it's likely this will be fixed only if someone sends a patch.

@bk2204 bk2204 added the bug label Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants