unable to get SSH keys working between sourcetree and github

前端 未结 4 1261
忘掉有多难
忘掉有多难 2020-12-29 03:22

I was able to create a key and connect to github following these instructions via the command prompt successfully:

https://help.github.com/articles/generating-ssh-ke

相关标签:
4条回答
  • 2020-12-29 03:53

    In order to get it worked I ended up going to Tools -> Options -> SSH Client and changing it to OpenSSH. I generated and uploaded several different types of keys trying to get it work as well but I think this is what finally did it.

    0 讨论(0)
  • 2020-12-29 03:54

    For Sourcetree on MacOS I had to change from OAuth to Basic authentication, use "git" as the username (not my GitHub username), and generate the SSH key and input it into GitHub. Only then could I clone a GitHub repo via SSH in Sourcetree.

    0 讨论(0)
  • 2020-12-29 04:00

    In my case, I needed to switch to a git or ssh based repo path rather than the https based repo path. This causes SourceTree to switch to SSH based authentication.

    This setting can be found at Repository => Repository setting => Paths

    Example:

    Correct repo paths

    git@github.com:<username>/<reponame>.git
    

    or

    ssh://git@github.com/<username>/<reponame>.git
    

    (Note: if you are working with a repo that isn't yours, replace username with organization name)

    Wrong repo path

    https://github.com/<username>/<reponame>.git
    

    HTTPS repo paths result in SourceTree trying to be extra smart and failing spectacularly. You get prompted for a username/password GUI dialog which will never work if you have 2 factor authentication enabled.

    0 讨论(0)
  • 2020-12-29 04:02

    You may want to consider switching from OpenSSH to Putty / Plink and use embedded Git instead of Git provided by host OS. Making ssh-agent work on Windows is a bit more complicated than clicking it out straight from the SourceTree and PuttyGen.

    If you want to still use terminal to configure SSH and start ssh-agent please see bottom two steps.

    Steps

    0 讨论(0)
提交回复
热议问题