【问题标题】:SSH project on github giving issuesgithub上的SSH项目给出问题
【发布时间】:2021-09-07 14:27:54
【问题描述】:

我完成了向 Github 添加密钥的整个过程,并在 Github 提供的 guide 上进行了所有操作,但之后,它每 5 分钟询问一次 ssh 密码,这在处理项目时非常烦人,所以找到了一个可以缓解这种情况的命令,但是今天早上我收到了一个错误,提示如下

C:\Windows\System32\OpenSSH\ssh.exe: C:WindowsSystem32OpenSSHssh.exe: command not found

重新运行以检查是否一切正常

$ ssh -T git@github.com

它通过了身份验证,但错误并没有消失,所以我运行了与周五相同的命令git config --global --add core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe

现在,当我执行“刷新”(推送和拉取)以获取对我的存储库的最新更改时,它会继续同步更改,就好像它是无限循环然后超时一样。

编辑***

如果我在 git bash 中运行 git pull 我会得到以下输出

$ git pull
CreateProcessW failed error:193
ssh_askpass: posix_spawnp: Unknown error
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

但在那之前,我跑了ssh -T git@github.com

输入密码后得到如下输出

Hi Faziki! You've successfully authenticated, but GitHub does not provide shell access.

有谁知道我可以做些什么来解决这个问题?

【问题讨论】:

    标签: git ssh


    【解决方案1】:

    我们的想法是使用 Windows 本身的任何东西,而只能使用您的 Git for Windows(确保获得最新的 2.33.0.2)

    因此,请从您的全局 Git 配置中删除任何 ssh 设置,并确保您的 %PATH% 包括:

    set GH=C:\path\to\git
    set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH%
    

    CMD 中的where ssh 应该给你:C:\path\to\git\usr\bin\ssh.exe

    从那里,在同一个 CMD 中,您可以键入“bash”以切换到 bash shelll 会话。
    确保your ~/.bashrc automatically launch the ssh agent.
    add your private key to the agent: 会缓存密码。

    【讨论】:

      猜你喜欢
      • 2015-10-28
      • 2020-02-12
      • 1970-01-01
      • 2021-02-19
      • 1970-01-01
      • 2014-10-28
      • 1970-01-01
      • 2019-12-07
      • 1970-01-01
      相关资源
      最近更新 更多