libgit2 / libgit2/libgit2sharp

failed to start SSH session: unable to exchange encryption keys

Open
#1,809 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

        var r = new Repository(working);
        r.Network.Remotes.Add("remote", @"git@gitlab.com:user1234/test.git");

        r.Network.Push(r.Network.Remotes["remote"], @"refs/heads/master", new PushOptions
        {
            CredentialsProvider =
            //(url, user, credentials) => new UsernamePasswordCredentials
            //{
            //    Username = "user1234",
            //    Password = "********"
            //}
            (url, user, credentials) => new SshUserKeyCredentials
            {
                Username = "git",
                Passphrase = string.Empty,
                PublicKey = @"C:\Users\me\.ssh\gitlab.pub",
                PrivateKey = @"C:\Users\me\.ssh\gitlab"
            }
        });

both UsernamePasswordCredentials and SshUserKeyCredentials (openssh keys already added to gitlab) give:

failed to start SSH session: unable to exchange encryption keys

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the Repository.Network.Push call and its CredentialsProvider in the report, comparing UsernamePasswordCredentials with SshUserKeyCredentials. Reproduce the push against the GitLab remote and investigate the reported “unable to exchange encryption keys” failure; done means the SSH session starts and the push succeeds with the supplied credentials.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.