git2go
git2go copied to clipboard
No error message for wrong auth
I'm trying to use the CredentialsCallback when pushing, and it's all working:
err = remote.Push([]string{"refs/heads/" + branch}, &git.PushOptions{
RemoteCallbacks: git.RemoteCallbacks{
CredentialsCallback: func(url string, username_from_url string, allowed_types git.CredType) (git.ErrorCode, *git.Cred) {
if called {
return git.ErrUser, nil
}
called = true
ret, creds := git.NewCredUserpassPlaintext(user, pass)
return git.ErrorCode(ret), &creds
},
},
})
fmt.Println(err)
This code tries the credentials once, then fails. However, while returning git.ErrUser in the callback, remote.Push simply returns an empty go error with no message, so there's no way for me of knowing that it was git.ErrUser. Am I doing something wrong? Shouldn't my last Println print a message?
Hi !
I recently dealt with that and I figured out that it requires the callback CertificateCheckCallback to be defined as well.
Example here https://github.com/jwaldrip/git-get/blob/master/callbacks.go#L17
Thanks so much @apflieger! I'll give it a try.