diff --git a/pkg/kapis/resources/v1alpha2/handler.go b/pkg/kapis/resources/v1alpha2/handler.go index 2ee6b2a82d16dd516dc8bf079c7056db9389742a..44c2c235e29179136d6d939c188a458c5d7f6926 100644 --- a/pkg/kapis/resources/v1alpha2/handler.go +++ b/pkg/kapis/resources/v1alpha2/handler.go @@ -274,8 +274,12 @@ func (r *resourceHandler) handleVerifyGitCredential(request *restful.Request, re api.HandleBadRequest(response, nil, err) return } - - err = r.gitVerifier.VerifyGitCredential(credential.RemoteUrl, credential.SecretRef.Namespace, credential.SecretRef.Name) + var namespace, secretName string + if credential.SecretRef != nil { + namespace = credential.SecretRef.Namespace + secretName = credential.SecretRef.Name + } + err = r.gitVerifier.VerifyGitCredential(credential.RemoteUrl, namespace, secretName) if err != nil { api.HandleBadRequest(response, nil, err) return