您的位置:首页 > 其它

用git cmd pull 或push 时提示密码错误的解决方法

2017-12-11 15:04 260 查看
有时候准备pull的时候却发现密码怎么输也输不对,提示的信息是没有权限或者密码错误,如下:

$ git pull
git@git.***.com's password:
Permission denied, please try again.
git@git.***.com's password:
Permission denied, please try again.
git@git.***.com's password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


如果出现以上类似的报错提示的话不妨试一下生成ssh-key的方法。步骤如下

在终端输入

ssh-keygen -t rsa -C "self name"    //self name为用户名


如果执行成功。返回

Generating public/private
rsa key pair.

Enter file in which to save the key (/home/forwhat.cn/.ssh/id_rsa):


后面的几步提示都可以直接回车

$ ssh-keygen -t rsa -C "self name"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/*****/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/*****/.ssh/id_rsa.
Your public key has been saved in /c/Users/*****/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ut9Y****Wwg*******8PYsvs4v+iDlk8xXqb++YkmM self name
The key's randomart image is:
+---[RSA 2048]----+
|    .o.          |
|     ooo         |
|    . *.         |
|.  . o o         |
|... .  S        |
| =o. . + .       |
|o.+oo . + o      |
|++Eo.oo O       |
|=BO+=+++=O..      |
+----[SHA2756]-----+
(敏感已处理)




把刚才上面显示的存储的地址放在vi编译器里运行会生成如下代码

vim /c/Users/*****/.ssh/id_rsa.pub(你的公钥)
//例
ssh-rsa AAAAB3NzaC1..............vvo1+xSKvIXLhjqvoHoyoj8oDkOycZeaOASJhbOT+6xvTuGutM/3SDoFkFzHjL34CnGLyX
sell name


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息