Git在Windows上使用ssh连接

mot*_*lrd 4 windows git github

我已经阅读了一些问题,但仍未找到解决此问题的方法

我在Windows上有git,我想使用ssh连接到github.按照本教程https://help.github.com/articles/generating-ssh-keys 我已经成功设置了我的密钥

如果我打开一个git-bash并尝试ssh github我能够连接,所以这是有效的

ssh -T git@github.com
Hi username! You've successfully authenticated, but GitHub does not
provide shell access.
Run Code Online (Sandbox Code Playgroud)

这意味着git-bash实际上看到了我的密钥.但是,如果我尝试推动

git push origin master
Run Code Online (Sandbox Code Playgroud)

git提示我输入用户名和密码
谢谢你的帮助

编辑:通过使用git协议而不是http协议解决,我的错,
所以替换它

https://github.com/_user_/_repository_.git  
Run Code Online (Sandbox Code Playgroud)

这个

git@github.com:_user_/_repository_.git  
Run Code Online (Sandbox Code Playgroud)

在远程链接中

dah*_*byk 5

无需删除/添加,只需执行以下操作:

git remote set-url origin git@github.com:username/repo.git
Run Code Online (Sandbox Code Playgroud)