【问题标题】:SSH issue with GitHub and terminal after push origin master推送源主机后 GitHub 和终端的 SSH 问题
【发布时间】:2021-02-02 12:56:31
【问题描述】:

我被 after 语句“无法获得引用控制台的文件描述符”所困扰。我不能再继续下去了。在这个问题上我需要你的帮助。我是一名新的 Web 开发人员,并继续学习以提高我的技能。感谢您花时间指导我正确的方向。

[ENV]:/vagrant/src/splurty $ git push origin master
    
ssh: connect to host github.com port 22: Connection refused
    fatal: Could not read from remote repository.
    
    
Please make sure you have the correct access rights
    and the repository exists.
    
[ENV]:/vagrant/src/splurty $ git remote set-url origin https://github.com/livestronger08/brolin.git
    
[ENV]:/vagrant/src/splurty $ eval "$(ssh-agent -s)"
    Agent pid 30162
    
[ENV]:/vagrant/src/splurty $ ssh-add
    Identity added: /home/vagrant/.ssh/id_rsa (/home/vagrant/.ssh/id_rsa)
    
[ENV]:/vagrant/src/splurty $ $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
    $: command not found
    
[ENV]:/vagrant/src/splurty $ ssh-keygen -t rsa -b 4096 -C "derek.downie@ttu.edu"
    
Generating public/private rsa key pair.
    
Enter file in which to save the key (/home/vagrant/.ssh/id_rsa): 
    /home/vagrant/.ssh/id_rsa already exists.
    
Overwrite (y/n)? y
    
Enter passphrase (empty for no passphrase): 
    
Enter same passphrase again: 
    
Passphrases do not match.  Try again.
    
Enter passphrase (empty for no passphrase): 
    
Enter same passphrase again: 
    
Your identification has been saved in /home/vagrant/.ssh/id_rsa.
    
Your public key has been saved in /home/vagrant/.ssh/id_rsa.pub.
    
The key fingerprint is:
    72:98:32:bc:e7:b1:05:0e:c6:99:17:3d:a0:00:6a:63 derek.downie@ttu.edu
    
The key's randomart image is:
    +--[ RSA 4096]----+
    |...   .          |
    |.  . . o         |
    |.E  . . o        |
    |o .o o + .       |
    |    X * S        |
    |   . B +         |
    |    . + .        |
    |     o +         |
    |      o          |
    +-----------------+
    
[ENV]:/vagrant/src/splurty $ eval 
    
[ENV]:/vagrant/src/splurty $ eval "$(ssh-agent -s)"
    Agent pid 30176
    
[ENV]:/vagrant/src/splurty $ open ~/.ssh/config
    Couldn't get a file descriptor referring to the console
    
[ENV]:/vagrant/src/splurty $ touch ~/.ssh/config

【问题讨论】:

  • 据我所知ssh-keygen 不会生成配置目录,因此应该会出现错误消息。您是否将新生成的密钥添加到 GitHub?
  • 不,我没有向 GitHub 添加新生成的密钥。我按照 Stack Overflow 上的说明一步一步地进行操作。不幸的是,此刻它无处可去。似乎我从事的所有项目都存在与 ssh 密钥相同的问题。所以需要通过GitHub生成新的ssh key?
  • ssh-keygen.ssh/id_rsa 中生成一个私钥,在.ssh/id_rsa.pub 中生成一个公钥。 public 需要通过settings->ssh keys 给github

标签: github ssh


【解决方案1】:

从您将远程存储库 URL(使用 git remote set-url origin https://github.com/livestronger08/brolin.git)设置为 HTTPS 的那一刻起,与 SSH 相关的所有其他命令都与身份验证无关。

仅当您在创建 SSH 密钥时输入了非空密码时才需要代理。

只有当您的 SSH 密钥不是默认的 ~/.ssh/id_rsa 名称时,才需要 ~/.ssh/config 文件。在你的情况下,你不需要它。

【讨论】:

  • 好的,我跳过了第 2 步,第 3 步与钥匙串访问有关。现在,我正在向我的 github 帐户添加一个新的 ssh 密钥。我在这里遇到了另一个问题。我无法将 ssh 密钥复制到我的 github 帐户中。我认为这些步骤现在让我感到困惑。
  • 这表明我无法将 ssh 密钥添加到我的 github 帐户。由于没有找到命令'pbcopy',你的意思是:命令'bcopy' from package...我不太明白。有人可以指导我正确的方向吗?
  • 我终于解决了 ssh 密钥的问题。现在一切都好。感谢 VonC 回答我关于 ~/.ssh/config 部分的问题。我会记住这一点,以备将来参考。
  • 正如你提到的,我必须跳过钥匙串访问。因此,我使用以下命令将密钥添加到 Github: $ cat ~/.ssh/id_rsa.pub 输出应该看起来像随机字母、数字和特殊字符。然后我把输出的内容复制到了github上的key部分。它解决了这个问题。现在我可以将所有编码推送到 github。 :o)
猜你喜欢
  • 2017-12-06
  • 1970-01-01
  • 2011-05-15
  • 2021-11-18
  • 1970-01-01
  • 2020-10-12
  • 1970-01-01
  • 1970-01-01
  • 2022-01-19
相关资源
最近更新 更多