如何在GitHub Desktop中使用SSH远程设备?

kyxcudwk  于 2023-08-01  发布在  Git
关注(0)|答案(6)|浏览(251)

我在Windows 10上使用GitHub桌面。我最初使用HTTPS URL克隆了一个repo,但现在我们的组织建议我们必须使用SSH URL。所以我把这个换了。
我还将我的SSH公钥(id_rsa.pub)的内容复制到我的GitHub帐户中。我的SSH密钥受密码保护。
现在,当我尝试在GitHub Desktop中进行同步时,我得到以下错误:
x1c 0d1x的数据
在Git Bash中,它工作得很好(虽然它在每次pull/push之前都会询问我的密码)。你知道我该怎么做才能成功吗

knsnq2tg

knsnq2tg1#

正如最近在“Permission failure cloning in Git in Windows”中看到的那样,尝试在以下情况下启动GitHub Desktop:
警告:先阅读评论)

git config --global core.sshCommand "'C:\Windows\System32\OpenSSH\ssh.exe'"

字符串
这将确保GitHub Desktop使用正确的OpenSSH ssh.exe,而不是内部的,如desktop/desktop issue 5641所示。

如果之后Git bash无法正常运行,您可以:

  • 恢复配置:
git config --global --unset core.sshCommand

git config --global core.sshCommand "'C:\Program Files\Git\usr\bin\ssh.exe'"


如果C:\Program Files\Git\usr\bin\已经在你的%PATH%中,你甚至不需要配置:Git For Windows中的ssh.exe将是默认选择的。

im9ewurl

im9ewurl2#

在搜索并尝试使用ssh-agent失败后,我发现如果你使用git bash shell启动github桌面,它会提示你输入密码。我在我的.bash_profile中添加了一个别名,以使启动github桌面更容易。
第一个月
我还将git core.sshCommand设置为这样,它适用于git bash和github desktop:

git config core.sshCommand "'C:\\Program Files\\Git\\usr\\bin\\ssh.exe' -i C:/Home/.ssh/id_rsa_name"

字符串

2jcobegt

2jcobegt3#

通过取消勾选系统OpenSSH设置解决了问题。


的数据

acruukt9

acruukt94#

我可以通过创建一个ssh配置文件来让它工作,该文件的内容类似于以下要点中提供的内容:
https://gist.github.com/JoaquimLey/e6049a12c8fd2923611802384cd2fb4a
我需要让它工作的最小内容是

Host github.com
    IdentityFile /c/Users/username/.ssh/id_github

字符串
在克隆存储库时,我必须使用URL选项,因为Github.com选项卡将使用HTTPS URL。

bqjvbblv

bqjvbblv5#

我现在也有这个问题。SSH在git-bash中与ssh-agent等一起运行良好。
但是如果你使用TortoiseGit,对我来说最简单的是从TortoiseGit,git-bash和github desktop全局使用TortoiseGitPlink.exe作为ssh-client:

git config --global core.sshCommand "'C:\Program Files\TortoiseGit\bin\TortoiseGitPlink.exe'"

字符串
这将默认使用Pageant来缓存当前会话的密码。在设置此之后,GitHub Desktop立即开始使用ssh repos再次工作。

mnowg1ta

mnowg1ta6#

我遇到了这个问题,但与我的Docker容器ssh密钥不在我的windows .ssh/文件夹中有关。
%userprofile%.ssh/

相关问题