2

在使用 GitHub 操作时,我得到了Error response from daemon: Get "https://ghcr.io/v2/": denied: denied

我使用了登录命令echo $CR_PAT | docker login ghcr.io -u $ghcr_user -password-stdin

在此处输入图像描述

4

2 回答 2

0

而不是使用echo $CR_PAT | docker login ghcr.io -u $ghcr_user --password-stdin使用

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

在此处输入图像描述

于 2021-12-11T07:56:36.877 回答
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 }}
于 2021-12-11T12:24:34.343 回答