tortoisegit推送ssh-key需要输入用户信息

 

修改了测试代码,却在提交代码时候又跳出来请输入用户名和密码,

后来发现,github push有两种方式,ssh方式和https方式。而https方式是不同的,具体来说,就是url信息的不同,实际的验证机制也是不同的。当建立了本机密钥之后,使用ssh方式实际上是不需要再次验证的,而https则每次都需要输入密码。而ssh方式更安全,不需要很麻烦去输入长长的密码。

打开看一下repo目录下的.git/config,果然,发现我的url是https方式。

[remote "origin"]
	url = https://coding.net/xxx/xxxxx.git
	fetch = +refs/heads/*:refs/remotes/origin/*
	puttykeyfile = X:\test\xxxx.ppk

默认clone下来时候选择成了https,导致每次都需要输入用户名和密码。修改一下配置文件中的url即可:

[remote "origin"]
	url = git@coding.net:xxx/xxxxx.git
	fetch = +refs/heads/*:refs/remotes/origin/*
	puttykeyfile = X:\test\xxxx.ppk
原文地址:https://www.cnblogs.com/fer-team/p/6814124.html