Search code examples
gitazure-devopsgit-lfsazure-repos

How do I debug Git LFS push failures?


I have a repo I'm migrating to Azure DevOps, the repo utilizes LFS for large files. Files in LFS range from hundreds of KB to hundreds of MB. When trying to push this repo into a new repo in Azure DevOps, the push stalls at some file (i.e. 3294/8278 files). There is no error, it just sits on that file progress for hours. The rest of the push (including pushing the repo itself) does not progress because it's blocked by this one file failure.

How could I go about identifying which file is causing the problem? Can I set LFS to show me which file it's currently trying to push? Can I only push subsets of files to narrow down which file is causing the issue?


Solution

  • You can debug Git LFS by setting certain environment variables before you push, like so: GIT_TRACE=1 GIT_TRANSFER_TRACE=1 GIT_CURL_VERBOSE=1 git push REMOTE BRANCH (where you replace REMOTE and BRANCH). (Note that that syntax requires a POSIX shell.)

    That will show the headers and the response of what's going on, which may help you troubleshoot. Normally, though, Git LFS should upload multiple files at a time, so it shouldn't be blocked in this way.

    Note that last time I checked, Azure DevOps has a bug where it doesn't handle files over a certain size (I think 128 MiB) when using HTTP/2. This is an intentional design decision on the part of Azure Repos due to a limitation in their service, more information about which can be found in this issue. You may find that that's what's going on here, in which case you can set http.version to HTTP/1.1 to get things working properly.