Sourcetree creates broken SSH config for GitLab

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: High
    • None
    • Affects Version/s: 4.2.1
    • Component/s: 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`

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

              Created:
              Updated:
              Resolved: