Clone a project from github/gitlab by SSH with an error #647
Copy link
Copy link
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
tiennou commentedon Mar 16, 2018
I'll infer you're on iOS, if that's not the case, please be more specific.
You need to update to a more recent Objective-Git : the libssh2 version we're packaging in the current release doesn't handle the new cipher suites that GitHub started enforcing in February.
semionenko commentedon Mar 19, 2018
Yes, i've used iOS. Could you please clarify to which version I need to upgrade?
tiennou commentedon Mar 19, 2018
We're currently waiting on libgit2 in #645. As a stopgap measure, you could use master directly in the meantime (it's tracking 0.27.rc-1), I don't think there were many breaking changes between 0.13 and almost-0.14, but YMMV.
I'll close this, feel free to stay tuned in #645.