Solution:
Root Cause: Header Stripping or S3 Signed URL Timeout on Private LFS Servers In self-hosted infrastructure (such as JFrog Artifactory, Sonatype Nexus, or custom S3 proxies), Git LFS uses a two-phase retrieval process: first, it queries the LFS server for object metadata, and second, it downloads binaries directly from object storage (S3/GCS) via pre-signed URLs. If corporate reverse proxies (Nginx, F5) strip
Authorization headers during the metadata handshake, or if client clocks drift causing pre-signed URL expiration, the server returns
403 Forbidden.
Diagnostic Verification: Inspect debug logs for URL redirect mismatches:
Copy
bash
GIT_TRACE=1 git lfs pull
Observe whether the secondary download request to the storage bucket fails after receiving the pre-signed URL:
Copy
text
trace git-lfs: HTTP: GET [https://s3.amazonaws.com/lfs-bucket/object-hash](https://s3.amazonaws.com/lfs-bucket/object-hash)...
LFS: [403] Request has expired / SignatureDoesNotMatch
Step-by-Step Fix: 1 Synchronize System Clock (NTP):
Ensure host workstation clock is synchronized to prevent AWS S3 pre-signed URL signature mismatches: Copy
bash
# Linux/macOS
sudo ntpdate -u time.apple.com || sudo chronyc step
# Windows
w32tm /resync
2 Configure Standalone LFS Authentication in .gitconfig:
Tell Git LFS to send credentials directly to the custom storage endpoint: Copy
bash
git config lfs.[https://artifactory.example.com/artifactory/api/lfs/repo.locksverify](https://artifactory.example.com/artifactory/api/lfs/repo.locksverify) false
git config lfs.customtransfer.lfs-folder.path "/path/to/custom-helper"
3 Pass Standalone Nginx / Proxy Headers:
Ensure ingress controllers forward Authorization headers without stripping bearer tokens. Prevention & Long-Term Monitoring: Monitor self-hosted LFS storage proxy logs and maintain synchronized NTP daemons across all workstations.