Can't push Git LFS in codespaces

Cloning and working with repositories that contain LFS managed files works just fine, but pushing them fails. When you try to push, you get the following error.

codespace:~/workspace/lfs-codespace-test$ git push
ERROR: Authentication error: Authentication required: You must have push access to verify locks
error: failed to push some refs to 'https://github.com/duncan/lfs-codespace-test'

Seemingly, the git credential mechanism isn’t working with LFS.

You can repo this by:

  1. Fork https://github.com/duncan/lfs-codespace-test
  2. Start it up in a codespace
  3. Do the git lfs install; git lfs pull; git lfs checkout dance to pull in the binary files.
  4. Make a change, any change, and commit it.
  5. Now try to push.

This is where you should see the fail. Now, you can prove to yourself that it’s lfs related by:

  1. Uninstalling lfs hooks with git lfs uninstall
  2. Now push

That should go in just fine.

Thanks for reporting this and for the really helpful repro! The intention is that Codespaces automatically authenticates you with the opened repo, and so we’ll take a look and see what’s going on with LFS support. Stay tuned!