1

I am using GitHub workflows to push a small package to a private GH container registry. Yesterday most of my workflows went through, but suddenly they stop working. I am not aware of any recent setting changes.

I am using {{ secrets.GITHUB_TOKEN}} with Workflow write permissions enabled.

enter image description here

I replaced my actual organization name with test-user for privacy reasons.

buildx failed with: ERROR: failed to solve: failed to push test-user/bar:1.8.2:
 failed to authorize: failed to fetch oauth token: unexpected status: 401 Unauthorized

This is an extract of my workflow file:

 - name: Login to Docker registry
 uses: docker/login-action@v2
 with:
 registry: ghcr.io
 username: ${{ github.repository_owner }}
 password: ${{ secrets.GITHUB_TOKEN }}
... 
 - name: Build and push
 uses: docker/build-push-action@v4
 with:
 context: .
 push: true
 tags: ${{ steps.meta.outputs.tags }}
 labels: ${{ steps.meta.outputs.labels }}

Any idea what could trigger the 401?

asked Jun 2, 2023 at 11:01
0

1 Answer 1

1

Make sure you are only pushing images with the ghcr.io/ prefix in the name. Otherwise, it will try to push to docker hub and fail if you haven't used the login action to login to docker hub.

answered Feb 28, 2024 at 17:41
Sign up to request clarification or add additional context in comments.

1 Comment

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.