Uploaded image for project: 'Sourcetree for Windows'
  1. Sourcetree for Windows
  2. SRCTREEWIN-14471

Getting 'ssh-agent' failed with code: object reference not set to an instance of an object error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Highest Highest
    • None
    • 3.4.17
    • Bitbucket
    • None
    • Severity 1 - Critical

      I recently got a new computer for work and have been setting up everything I use on a daily basis to start using it. However, I am getting the following error in Sourcetree after trying to configure settings to use OpenSSH and SSH keys I created using command line:

      'ssh-agent' failed with code: -1: System.NullReferenceException: Object reference not set to an instance of an object.

      Here are the things I did before I received the error:

      1. installed Git: https://git-scm.com/download/win.; basically using the default settings.
      2. Downloaded Sourcetree and ran as administrator and followed the prompts:
        1. chose BitBucket
        2. cleared the Mercruial checkbox--since we don't use that and don't need it
        3. entered my username and email as my commit ID.
      3. Once installed, I left it alone and created my SSH keys using command line and associated to my Bitbucket account; then configured in Sourcetree. I used the steps we have written up internally (for our documentation team) that has worked since we started using Sourcetree years ago. If I could attach a screenshot of the steps I'd do that.
      4. After creating my SSH keys, I opened Sourcetree > Settings > General. I selected OpenSSH and browsed/linked to the SSH keys I created.
      5. After clicking OK on the settings panel is when I receive the error.

      FYI, I have done these same steps on my old computer and have had no issues, which has now been about 4.5 years that it has been working on my old computer. It is simply when trying to do the EXACT same steps (with a newer version of Sourcetree, BitBucket, and probably Git) that I'm having this issue. Also, I had two other coworkers that went through the exact same process (i.e., got a new computer, completed the aforementioned steps) back in February 2024 and did not encounter the error I am receiving.

      I've tried uninstalling/reinstalling Sourcetree. I've also tried creating new SSH keys and copying the SSH key files from my old computer (where they and Sourcetree work) onto my new computer, restarting my computer, etc. and am still getting the error. I have even tried completing the steps from this case: https://community.atlassian.com/t5/Sourcetree-questions/SourceTree-won-t-start-after-Windows-Update-on-June-13-2023/qaq-p/2390682, and I still get the error. 

      I reached out to the IT team at the company I work for and they tried everything I've mentioned above as well as some other things, and I still get the error. They said it is probably a Sourcetree issue and that I needed to contact Atlassian. Sourcetree and communicating with Bitbucket is extremely crucial to what I do for work.

            Unassigned Unassigned
            335120ac040e Danielle Withers
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: