Sourcetree creates incorrect SSH config file for GitHub account

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Low
    • None
    • Affects Version/s: 2.7.6
    • Component/s: None
    • None
    • Environment:

      macOS High Sierra 10.13.6

      Sourcetree 2.7.6 (177) for Mac

    • Severity 1 - Critical

      Sourcetree generates or adds to a config file in the users .ssh directory.  The default text is something like (don't remember the exact Host)

       

      --- Sourcetree Generated ---
      Host account-name@github.com
              HostName github.com
              User username
              PreferredAuthentications publickey
              IdentityFile /Users/matt/.ssh/keyname
              UseKeychain yes
              AddKeysToAgent yes
      # ----------------------------
      

       

      However, GitHub requires that you use SSH with git as the user.  So the above config tells Sourcetree to use your GitHub username which results in permission denied.  Changing the ~/.ssh/config file to the below code allowed me to clone my repositories from GitHub.  I'm not sure if changing the Host to github.com is required as well, but it works so I'm not messing with it!

       

      --- Sourcetree Generated ---
      Host github.com
              HostName github.com
              User git
              PreferredAuthentications publickey
              IdentityFile /Users/matt/.ssh/keyname
              UseKeychain yes
              AddKeysToAgent yes
      # ----------------------------
      

            Assignee:
            Unassigned
            Reporter:
            Matt Strong
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: