tur*_*2oh 27 putty github ssh-keys atlassian-sourcetree
我能够通过命令提示符成功创建密钥并按照这些说明连接到github:
https://help.github.com/articles/generating-ssh-keys
但是,当我尝试通过Sourcetree和putty连接时,我不能.我试过了:
我也尝试打开从github命令行指令生成的密钥,它希望我将它转换为我做过并保存的putty类型密钥,尝试使用该密钥.也没有运气.
我究竟做错了什么?
tur*_*2oh 51
为了使它工作,我最终转到工具 - >选项 - > SSH客户端并将其更改为OpenSSH.我生成并上传了几种不同类型的密钥,试图让它工作,但我认为这是最终做到的.
Dee*_*101 24
在我的情况下,我需要切换到一个git或ssh基于repo路径而不是https基于repo路径.这会导致SourceTree切换到基于SSH的身份验证.
此设置可在以下位置找到 Repository => Repository setting => Paths
例:
正确的回购路径
git@github.com:<username>/<reponame>.git
Run Code Online (Sandbox Code Playgroud)
要么
ssh://git@github.com/<username>/<reponame>.git
Run Code Online (Sandbox Code Playgroud)
(注意:如果您使用的是不属于您的仓库,请替换username为organization name)
错误的回购路径
https://github.com/<username>/<reponame>.git
Run Code Online (Sandbox Code Playgroud)
HTTPS repo路径导致SourceTree试图变得更加智能并且非常失败.系统会提示您输入用户名/密码GUI对话框,如果启用了2因素身份验证,则该对话框将永远不会有效
Ade*_*eel 14
Github要使用SourceTree您可以使用访问令牌登录帐户。要创建访问令牌,请按照以下步骤操作。
SettingsDeveloper settings从左侧窗格中选择Personal access tokenGenerate new token按钮然后在 SourceTree 应用程序中按照以下步骤操作(对于 Mac 用户,不确定其他平台)
GitHub从Host下拉列表中选择Basic从下拉列表中选择Auth Type并HTTPS从Protocol下拉列表中选择username在用户名字段中输入您的 GitHubaccess token将上一步生成的粘贴到Password字段中
对于 Mac 版本的 SourceTree,工具菜单不存在。
但是,您可以将 ssh 密钥添加到 Mac OS 中的钥匙串中。请参阅:https ://superuser.com/questions/879050/sourcetree-ssh-options-on-os-x
在 Mac OSX 上,本机 SSH 客户端可以直接使用内置钥匙串。要将您的私钥添加到钥匙串,只需使用以下命令:
ssh-add -K /path/of/private/key
Run Code Online (Sandbox Code Playgroud)
例如,如果您的私钥存储在 ~/.ssh 并名为 id_rsa,您将使用以下命令:
ssh-add -K ~/.ssh/id_rsa
Run Code Online (Sandbox Code Playgroud)
然后系统将提示您输入密码,该密码将存储在您的钥匙串中。之后,您应该准备好进行无密码登录。
| 归档时间: |
|
| 查看次数: |
29386 次 |
| 最近记录: |