Uploaded image for project: 'Sourcetree For Mac'
  1. Sourcetree For Mac
  2. SRCTREE-8004

Sourcetree creates broken SSH config for GitLab

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • None
    • 4.2.1
    • GitLab
    • None
    • Severity 2 - Major

      Issue Summary

      Link to original community question here

      So, SourceTree has a bug trying to interract with GitLab (on OSx 12.6.3)

      First of all I tried to setup connection using private token, created in GitLab profile settings. I granted all the access to that token, added account in SourceTree, successfully logged in and I could grab the repo from GitLab using https link.

      However, I couldn't push any changes receiving error
      `git@gitlab.com: Permission denied `

      Using SourceTree on Windows 11 i didn't have any issue - after logging (just login/password, not a private token) I could execute any operation.

      After founding the answer in GitLab I posted above I found that /Users/<User>/.ssh/config had a wrong entry.

      Expected Results

      # --- Sourcetree Generated ---
      Host gitlab.com
      HostName gitlab.com
      User <username>
      PreferredAuthentications publickey
      IdentityFile /Users/<user>/.ssh/<user>-GitLab
      UseKeychain yes
      AddKeysToAgent yes
      # ----------------------------
      

      Actual Results

      # --- Sourcetree Generated ---
      Host <user>-GitLab
      HostName GitLab
      User <username>
      PreferredAuthentications publickey
      IdentityFile /Users/<user>/.ssh/<user>-GitLab
      UseKeychain yes
      AddKeysToAgent yes
      # ----------------------------
      

      Steps to Reproduce

      see above

      Workaround

      So, to workaround this issue you need to open `~/.ssh/config ` and change `host` and `hostname` to correct value: `gitlab.com`

              Unassigned Unassigned
              43c951f935c6 Raman Sidarakin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: