Closed mssun closed 7 years ago
Can you share the code you are using? I didn't see this behavior before.
Here is a minimal code snippet (I am using Swift with bridging header).
let credential = GTCredentialProvider { (allowedTypes, url, username) -> GTCredential in
print("get credential")
var cred = GTCredential()
do {
cred = try GTCredential(userName: "wrong name", password: "wrong password")
} catch {
print(error)
}
return cred
}
do {
print("start cloning...")
let credentialProvider = credential
let options: [String: Any] = [
GTRepositoryCloneOptionsCredentialProvider: credentialProvider
]
try GTRepository.clone(from: URL(string: "https://github.com/mssun/password-store.git")!, toWorkingDirectory: URL(fileURLWithPath: "\(Globals.shared.documentPath)/password-store-test"), options: options, transferProgressBlock:nil, checkoutProgressBlock: nil)
print("clone finish")
} catch {
print(error)
}
The output are
start cloning...
get credential
get credential
get credential
get credential
get credential
get credential
get credential
get credential
get credential
Seems to be exactly like what I am doing. Have you tried stepping through the ObjectiveGit code?
I haven't stepping into the ObjectiveGit code yet. Did you reproduce my issue?
This is a feature by design. Not an issue. I'm closing it. Thanks.
I'm running into the same issue on fetches, and having a bit of a hard time understanding why this is a feature? How is one supposed to report invalid credentials (say user fat fingered the password)?
Because this allows to try multiple credentials without starting over the whole connection on each attempt. Think automatically trying a SSH key first, another SSH key 2nd, and finally ask the user a password.
IOW, you have to keep track yourself of the # of GIT_EAUTH
failures for each "credential" object, in order to report "fat-fingering".
I found that when providing a wrong username and password credential to clone a GitHub private repository (https protocol), it will not report an error. Instead, the clone function will loop and continue calling GTCredentialProvider block for credential. Is this normal? Then, how can I know if it failed to clone a repository because of wrong password?