A can't upload image to lfs in netlify

A post was split to a new topic: Git push issues with Git LFS and/or Large Media

Hi, @dev-boldium-ebce. It seems silly to ask but just to be sure, are you sure you are logged in (or using a token)? In other words, does the following command show you logged in as yourself?

netlify status

I’m guessing the answer is “yes” but I want to confirm to be sure. Assuming “yes”, would you please private message PM the output of the command below to me?

GIT_TRACE=true GIT_CURL_VERBOSE=true git lfs push --all origin

It is probably safe to share the output publicly. Again, I recommend PM-ing to be safe but please do whichever you prefer.

Now if, on the other hand, the output of netlify status does not show you logged in using the Netlify CLI, that is a problem and we will need to start there first. If that is happening, please let us know.

Hey @luke it looks like I’m logged in, so I’ll private message you, Here’s the output of netlify status

──────────────────────┐
 Current Netlify User │
──────────────────────┘
Name:  dev-boldium
Email: dev+ebce@boldium.com
Teams: 
  dev-ebce's team: Collaborator 

Hi, @dev-boldium-ebce. I’m going to share a bit of output here in two examples of the GIT_TRACE=true GIT_CURL_VERBOSE=true git lfs push --all origin.

This first example is a working push from my system (and don’t worry, that isn’t my real password in the logs).

Working example:

20:26:42.069608 trace git-lfs: tq: sending batch of size 4
20:26:42.070874 trace git-lfs: api: batch 4 files
20:26:42.071024 trace git-lfs: creds: git credential fill ("https", "fe21b1ce-1d9a-4899-bbff-a0d7bcb55ad0.netlify.app", "")
20:26:42.075218 git.c:444               trace: built-in: git credential fill
20:26:42.076172 run-command.c:663       trace: run_command: 'git credential-netlify get'
20:26:42.087781 git.c:704               trace: exec: git-credential-netlify get
20:26:42.088516 run-command.c:663       trace: run_command: git-credential-netlify get
time="2020-10-15T20:26:42-07:00" level=debug msg="Initializing Netlify credential helper" args="[/Users/username/.netlify/helper/bin/git-credential-netlify get]"
time="2020-10-15T20:26:42-07:00" level=debug msg="Git input received" host=fe21b1ce-1d9a-4899-bbff-a0d7bcb55ad0.netlify.app protocol=https
time="2020-10-15T20:26:42-07:00" level=debug msg="Writing output data" host=fe21b1ce-1d9a-4899-bbff-a0d7bcb55ad0.netlify.app password="12345" protocol=https username=access-token
20:26:42.570702 trace git-lfs: Filled credentials for https://fe21b1ce-1d9a-4899-bbff-a0d7bcb55ad0.netlify.app/.netlify/large-media
20:26:42.571156 trace git-lfs: exec: /usr/bin/security 'list-keychains'
20:26:42.594467 trace git-lfs: exec: /usr/bin/security 'find-certificate' '-a' '-p' '-c' 'fe21b1ce-1d9a-4899-bbff-a0d7bcb55ad0.netlify.app' '/Library/Keychains/System.keychain'
20:26:42.621249 trace git-lfs: HTTP: POST https://fe21b1ce-1d9a-4899-bbff-a0d7bcb55ad0.netlify.app/.netlify/large-media/objects/batch

Those logs contain lines referencing the Git credential helper (“git-credential-netlify”):

20:26:42.076172 run-command.c:663       trace: run_command: 'git credential-netlify get'
20:26:42.087781 git.c:704               trace: exec: git-credential-netlify get
20:26:42.088516 run-command.c:663       trace: run_command: git-credential-netlify get
time="2020-10-15T20:26:42-07:00" level=debug msg="Initializing Netlify credential helper" args="[/Users/luke/.netlify/helper/bin/git-credential-netlify get]"

Here is a sample of the output you sent me (and your doesn’t contain a password line:

21:56:30.319299 trace git-lfs: tq: running as batched queue, batch size of 100
21:56:30.320097 trace git-lfs: run_command: git rev-list --objects --do-walk --stdin --
21:56:30.323175 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'cat-file' '--batch-check'
21:56:30.326077 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' '--git-common-dir'
21:56:30.352981 trace git-lfs: tq: sending batch of size 100
21:56:30.354457 trace git-lfs: api: batch 100 files
21:56:30.354871 trace git-lfs: exec: /usr/bin/security 'list-keychains'
21:56:30.378748 trace git-lfs: exec: /usr/bin/security 'find-certificate' '-a' '-p' '-c' '8af78b07-6f98-4b04-9a19-2daa8040e79e.netlify.app' '/Library/Keychains/System.keychain'
21:56:30.404320 trace git-lfs: HTTP: POST https://8af78b07-6f98-4b04-9a19-2daa8040e79e.netlify.app/.netlify/large-media/objects/batch

We know the issue is definitely that your Git client is not using the credential helper. Now we need to figure out why.

If you run git version does it output 2.28.0? (I suspect it does.)

I think the real clue is that the credential.helper lines change after you try the git push. They effectively become this:

credential.helper=
credential.helper=netlify
credential.helper=osxkeychain
credential.helper=netlify

I think this is causing the “netlify” helper to be used last or not at all but this is just a guess.

Would you please run the following command and share the output here?

 git help -a | grep credential-

For example, this is what I see:

$ git help -a | grep credential-
   credential-cache     Helper to temporarily store passwords in memory
   credential-store     Helper to store credentials on disk
   credential-gcloud.sh
   credential-netlify

This will tell us if it is an ordering issue or if the credential-netlify helper is missing entirely.

I work at an agency and I’m under a time crunch and so the feedback rounds being a whole day between messages are just too much. We’ve decided to go in a different direction and move our media hosting to Cloudinary instead. Thanks for all the work, I’m sure given enough time we would’ve figured it out.

Hi, @dev-boldium-ebce. If you want to troubleshoot this further in the future, please reply here anytime and we will be happy to do so.