简体   繁体   English

使用 ssh 密钥通过 ssh 服务器与 github

[英]Using ssh keys through ssh server with github

For running high performance scripts i have to use a ssh-server.为了运行高性能脚本,我必须使用 ssh-server。

For transfering the files i have made a github repository.为了传输文件,我创建了一个 github 存储库。 However when pulling from the ssh server it still asks for username and password.然而,当从 ssh 服务器拉取时,它仍然要求输入用户名和密码。 These it says are invalid, propably because i have 2-factor validation.它说的这些是无效的,可能是因为我有 2 因素验证。

I have tried to generate a ssh key on the server, and added it to github.我试图在服务器上生成一个 ssh 密钥,并将其添加到 github。 It however still asks for the username and password.但是,它仍然要求输入用户名和密码。

The reason seems to be that it looks in the openssh folder instead of the folder with the generated keygens.原因似乎是它在 openssh 文件夹中查找,而不是在带有生成的密钥生成器的文件夹中。 This folder contains files:此文件夹包含文件:

  • ctr-cavstest ctr-cavtest
  • gnome-ssh-askpass gnome-ssh-askpass
  • sftp-server sftp 服务器
  • ssh-askpass ssh-askpass
  • ssh-keysign ssh-keysign
  • ssh-pkcs11-helper ssh-pkcs11-helper

So my question is:所以我的问题是:

  • Can i add any of these to github to solve the problem?我可以将其中任何一个添加到 github 来解决问题吗?
  • Or is there a way to make it use the generated keys which are in a different repository?或者有没有办法让它使用不同存储库中生成的密钥?

These it says are invalid, propably because i have 2-factor validation.它说的这些是无效的,可能是因为我有 2 因素验证。

That kind of warning is generally seen for HTTPS URLs, not SSH.这种警告通常出现在 HTTPS URL,而不是 SSH。

So check first, as commented, your git remote -v before doing your git pull .因此,如评论所述,首先检查您的git remote -v在执行git pull之前。
If it starts with https:// , try first:如果它以https://开头,请先尝试:

git remote set-url origin git@github.com:<me>/<myrepo>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM