Skip to content

Commit

Permalink
fix: fix the issue with getting credentials for docker.io (#703)
Browse files Browse the repository at this point in the history
Fixes #697

Signed-off-by: Sylvia Lei <[email protected]>
  • Loading branch information
Wwwsylvia authored Jun 6, 2023
1 parent 86f01b7 commit 651412a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/notation/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,13 @@ func runLogin(ctx context.Context, opts *loginOpts) error {
// ErrPlaintextPutDisabled returned by Login() indicates that the
// credential is validated but is not saved because there is no native
// credentials store available
if savedCred, err := credsStore.Get(ctx, registryName); err != nil || savedCred != cred {
credKeyName := registryName
if registryName == "docker.io" {
// it's as expected that credentials for "docker.io" are stored
// under the key "https://index.docker.io/v1/"
credKeyName = "https://index.docker.io/v1/"
}
if savedCred, err := credsStore.Get(ctx, credKeyName); err != nil || savedCred != cred {
if err != nil {
// if we fail to get the saved credential, log a warning
// but do not throw the GET error, as the error could be
Expand Down

0 comments on commit 651412a

Please sign in to comment.