milkey-mouse / git-lfs-s3-proxy

Store Git LFS files on any service with an S3 API
https://git-lfs-s3-proxy.pages.dev
Creative Commons Zero v1.0 Universal
59 stars 39 forks source link

Authorization error #10

Closed SirLorrence closed 9 months ago

SirLorrence commented 9 months ago

After following the steps provided in the README. I'm still unable to push; initially, when it starts, there's a KB of progress, and then it stops. After several retries, it fails and throws an LFS: Authorization error. I'm using an empty Linode Object Storage.

LFS: Authorization error: {URL}
Check that you have proper access to the repository.
milkey-mouse commented 9 months ago

Hey, thanks for reporting this. It looks like when generating presigned URLs, the aws4fetch library (and thus git-lfs-s3-proxy) guess the "service" parameter wrong for Linode URLs, which is enough to make the URL's signature not match what Linode expects, causing your error.

I've added the ability to specify these parameters in the LFS URL (in fac525df616c773447d46e3a35459b7e72490936). A quick fix for your problem should be to add a service=s3 before your endpoint URL, i.e. if your original LFS URL was

https://foo:bar@git-lfs-s3-proxy.pages.dev/us-sea-1.linodeobjects.com/my-repo

then your new URL should be:

https://foo:bar@git-lfs-s3-proxy.pages.dev/service=s3/us-sea-1.linodeobjects.com/my-repo

I've tested this with Linode Object Storage and it seems to fix the problem, LMK if it doesn't work.

In the longer term, I'll submit a PR to aws4fetch so it guesses this parameter correctly for Linode Object Storage and/or add something to the docs about this. I'll keep this issue open until I do.

SirLorrence commented 9 months ago

Yeah, that fixed it; thank you so much!!!!!