git clone 提示输入git@xxx的密码

如下:

suse:~/ecox # git clone git@vcs.in.ww-it.cn:ecox/ecox.git
正克隆到 'ecox'...
git@vcs.in.ww-it.cn's password:

 但是我都不知道密码是啥,跟登录git库的密码不一样。

然后使用http的方式,报一个错误:

use:~/ecox # git clone https://vcs.in.ww-it.cn/ecox/ecox.git
正克隆到 'ecox'...
fatal: unable to access 'https://vcs.in.ww-it.cn/ecox/ecox.git/': SSL certificate problem: unable to get local issuer certificate

提示SSL证书错误。发现说这个错误并不重要是系统证书的问题,系统判断到这个行为会造成不良影响,所以进行了阻止,只要设置跳过SSL证书验证就可以了,那么用命令 :

 git config --global http.sslVerify false

然后可以了,但是还是会要用户名和密码:

suse:~/ecox # git clone https://vcs.in.ww-it.cn/ecox/ecox.git
正克隆到 'ecox'...
Username for 'https://vcs.in.ww-it.cn': xxx
Password for 'https://xxx@vcs.in.ww-it.cn':
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://vcs.in.ww-it.cn/ecox/ecox.git/'

回到了老问题,于是想到设置git账户的密码,改一下试试?

在准备改密码的过程中,发现用户下面可以配置ssh-key,于是尝试配一下ssh-key来让ssh信任:

use:~/ecox # ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):

最后果然不需要再输入密码了,成功clone项目,所以在这里记录一下,方便以后查阅。

原文地址:https://www.cnblogs.com/kuang17/p/9676065.html