使用ssh-key无需密码即可推送到GitHub [英] Push to GitHub without a password using ssh-key

查看:71
本文介绍了使用ssh-key无需密码即可推送到GitHub的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我生成了一个没有密码的SSH密钥对,并将公共密钥添加到了GitHub.

I generated an SSH key pair without a password and added the public key to GitHub.

user@dev:/var/www/project# ssh -T git@github.com
Hi User! You've successfully authenticated, but GitHub does not provide shell access.

成功,当我重命名密钥时,它失败了.

was successful and when I rename the key, it fails.

但是当我要推送更改时,它仍然会询问我用户名和密码的组合.

But when I want to push my changes, it stills ask me for my username and password combination.

有没有密码输入的方​​法吗?

Is there a way to push without a password?

推荐答案

如果要求您提供用户名和密码,则您的源远程服务器将指向HTTPS URL,而不是SSH URL.

If it is asking you for a username and password, your origin remote is pointing at the HTTPS URL rather than the SSH URL.

将其更改为ssh.

例如,像Git这样的GitHub项目将具有HTTPS URL:

For example, a GitHub project like Git will have an HTTPS URL:

https://github.com/<Username>/<Project>.git

和SSH之一:

git@github.com:<Username>/<Project>.git

您可以这样做:

git remote set-url origin git@github.com:<Username>/<Project>.git

更改URL.

这篇关于使用ssh-key无需密码即可推送到GitHub的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆