Closed
Description
I see the error:
Error Domain=GTGitErrorDomain Code=-1 "Failed to start SSH session: Unable to exchange encryption keys".
I've have simple code for clone project from github:
GTCredentialProvider *credentialProvider = [GTCredentialProvider providerWithBlock:^GTCredential * _Nonnull(GTCredentialType type, NSString * _Nonnull URL, NSString * _Nonnull userName)
{
// the code newer called now
NSError *error;
GTCredential *credential;
GPSSHKey *sshKey = [GPObjects fetchSSHKeyWithType:SSHKeyTypeGitHub];
if (type & GTCredentialTypeSSHKey && sshKey != nil)
{
NSString *username = userName.length > 0 ? userName : hostingProvider.username;
credential = [GTCredential credentialWithUserName:username publicKeyURL:sshKey.publicKeyStorageURL privateKeyURL:sshKey.privateKeyStorageURL passphrase:sshKey.passphrase error:&error];
}
else if (type & GTCredentialTypeUserPassPlaintext)
{
if (hostingProvider.username.length > 0 && hostingProvider.password.length > 0)
{
credential = [GTCredential credentialWithUserName:hostingProvider.username password:hostingProvider.password error:&error];
}
else if (sshKey != nil)
{
NSString *username = userName.length > 0 ? userName : hostingProvider.username;
if (!username) {
username = @"";
}
credential = [GTCredential credentialWithUserName:username publicKeyURL:sshKey.publicKeyStorageURL privateKeyURL:sshKey.privateKeyStorageURL passphrase:sshKey.passphrase error:&error];
}
}
return credential;
}];
[options setObject:credentialProvider forKey:GTRepositoryCloneOptionsCredentialProvider];
[options setObject:@(YES) forKey:GTRepositoryCloneOptionsCloneLocal];
GTRepository *repository = [GTRepository cloneFromURL:gitURL toWorkingDirectory:localURL options:options error:&error transferProgressBlock:^(const git_transfer_progress * _Nonnull progress, BOOL * _Nonnull stop) {}];
Could you help me please? I don't know why it happens. A pair of ssh keys exist and public key is used in github. I don't understand what I should do in the project / settings to get rid of this.
Thanks.
Metadata
Metadata
Assignees
Labels
No labels