-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
I have written a custom Git LFS server for the purpose of hosting a public file server doubling as a git repository. The API spec for /objects/batch states the following:
All Batch API requests use the POST verb, and require the following HTTP headers. The request and response bodies are JSON.
Accept: application/vnd.git-lfs+json
Content-Type: application/vnd.git-lfs+json
As such, I have enforced on my custom server implementation that any requests to that endpoint MUST have Content-Type set to the correct value. If it is not set, the server will return Invalid Content-Type header - must be application/vnd.git-lfs+json.
I've run the following commands in a test repo:
git config --add lfs.url https://api.openfast.download/
git lfs track *.bz2
git add .\tf\maps\example.bz2
git commit -m "add example file"
git push
And the response from the final command:
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s, done.
batch response: Invalid Content-Type header - must be application/vnd.git-lfs+json
error: failed to push some refs to 'https://github.com/OpenFastDL/DataTest'
I am unsure if I am misreading the API spec and if these are only supposed to be headers set in the RESPONSE, but if so, this wording is a little confusing, so it might be a good idea to clarify exactly what headers are expected to be sent and received. I have confirmed that my LFS server implementation works perfectly when running things manually via Postman.
*Note: I apologize as I do not have an easy way to determine what headers are actually being sent by my git client. If you know of any way I can expose this information in some verbose way, please do let me know! I did not think to make my server spit out what the "incorrect" header is, so that bit of information is lost on my end, but if it is the only way, I can make that change.
Output of git lfs env
git-lfs/3.2.0 (GitHub; windows amd64; go 1.18.2)
git version 2.37.3.windows.1
Endpoint=https://api.openfast.download/ (auth=basic)
LocalWorkingDir=D:\Code\DataTest
LocalGitDir=D:\Code\DataTest\.git
LocalGitStorageDir=D:\Code\DataTest\.git
LocalMediaDir=D:\Code\DataTest\.git\lfs\objects
LocalReferenceDirs=
TempDir=D:\Code\DataTest\.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=D:\Code\DataTest\.git\lfs
AccessDownload=basic
AccessUpload=basic
DownloadTransfers=basic,lfs-standalone-file,ssh
UploadTransfers=basic,lfs-standalone-file,ssh
GIT_EXEC_PATH=C:/Program Files/Git/mingw64/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"