While using with the GitHub action I am getting Error response from daemon: Get "https://ghcr.io/v2/": denied: denied

I used the login command echo $CR_PAT | docker login ghcr.io -u $ghcr_user -password-stdin

enter image description here

MT0's user avatar

MT0

169k12 gold badges66 silver badges127 bronze badges

asked Dec 11, 2021 at 7:56

Neeraj Singh Negi's user avatar

0

I believe the command you want should be:

echo "$CR_PAT" | docker login ghcr.io -u "$ghcr_user" --password-stdin

That adds quoting to the variables and a second dash to the long arg. It also assumes those variables are defined.

That said, I tend to use the following in GitHub Actions for doing the login:

    - ​name​: ​Login to GHCR 
      ​uses​: ​docker/login-action@v1  
      ​with​: 
        ​registry​: ​ghcr.io 
        ​username​: ​${{ secrets.GHCR_USERNAME }} 
        ​password​: ​${{ secrets.GHCR_TOKEN }}

answered Dec 11, 2021 at 12:24

BMitch's user avatar

BMitchBMitch

265k50 gold badges542 silver badges499 bronze badges

You may try logout and then login. Or even removing the docker credentials (at ~/.docker/config.json in Linux) and then trying to login again.

This resolved the issue for me and many others

answered Mar 6, 2024 at 17:41

therealak12's user avatar

therealak12therealak12

1,3262 gold badges14 silver badges29 bronze badges

1

I forgot to run docker login as sudo.

sudo docker login ghcr.io -u Nevah5

answered Mar 30, 2024 at 19:03

Nevah5's user avatar

What worked for me was this

docker login --username MY_GITHUB_USERNAME --password-stdin
[paste value of $CR_PAT here]

answered Mar 24, 2023 at 10:37

Igbanam's user avatar

IgbanamIgbanam

6,0825 gold badges47 silver badges72 bronze badges

If you have two-factor authentication enabled in GitHub settings, make sure to use personal access token instead of a password.

answered Dec 15, 2024 at 10:19

YouQam's user avatar

YouQamYouQam

612 silver badges8 bronze badges

Instead of using echo $CR_PAT | docker login ghcr.io -u $ghcr_user --password-stdin use

docker login ghcr.io -u $ghcr_user -p $CR_PAT

enter image description here

answered Dec 11, 2021 at 7:56

Neeraj Singh Negi's user avatar

1

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.