git连接报错:Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)
在Linux上已经安装过git(自己搭建)了,本机(windows)想连接过去,通过git bash敲了下clone命令提示没权限:
$ git clone git@111.11.111.11:code.git
Cloning into 'code'...
The authenticity of host '111.11.111.11 (111.11.111.11)' can't be established.
ECDSA key fingerprint is SHA256:7jmL7Nrr9zJ7psJd3Zcfr4UckRNOMkgwK/ae9dsCgaw.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '111.11.111.11' (ECDSA) to the list of known hosts.
git@111.11.111.11's password:
Connection closed by 111.11.111.11 port
fatal: Could not read from remote repository. Please make sure you have the correct access rights
and the repository exists.
第一次连接失败很正常,毕竟没有设置账号信息,但第二次连接敲了自己刚设置的密码,竟然一直提示没权限
$ git clone git@111.11.111.11:code.git
Cloning into 'code'...
git@111.11.111.11's password:
Permission denied, please try again.
git@111.11.111.11's password:
Permission denied, please try again.
git@111.11.111.11's password:
git@111.11.111.11: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,pas sword).
fatal: Could not read from remote repository. Please make sure you have the correct access rights
and the repository exists.
蒙圈了,密码对的啊。看下日志:
$ ssh -vT git@111.11.111.11
OpenSSH_7.6p1, OpenSSL 1.0.2n Dec
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 111.11.111.11 [111.11.111.11] port .
debug1: Connection established.
debug1: identity file /c/Users/wulf/.ssh/id_rsa type
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_rsa-cert type -
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_dsa type -
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_dsa-cert type -
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_ecdsa type -
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_ecdsa-cert type -
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_ed25519 type -
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_ed25519-cert type -
debug1: Local version string SSH-2.0-OpenSSH_7.
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.
debug1: match: OpenSSH_7. pat OpenSSH* compat 0x04000000
debug1: Authenticating to 111.11.111.11: as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: aes128-ctr MAC: umac--etm@openssh.com comp ression: none
debug1: kex: client->server cipher: aes128-ctr MAC: umac--etm@openssh.com comp ression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:7jmL7Nrr9zJ7oooo5Zcfr4UckRNO MkgwK/ae9dsCgaw
debug1: Host '111.11.111.11' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/wulf/.ssh/known_hosts:
debug1: rekey after blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-,rsa-sha2->
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mi c,password
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:gXnx5odooo7yK+Imse/ggjIzZdooooJwCU6T6PEy spk /c/Users/wulf/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mi c,password
debug1: Trying private key: /c/Users/wulf/.ssh/id_dsa
debug1: Trying private key: /c/Users/wulf/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/wulf/.ssh/id_ed25519
debug1: Next authentication method: password
然后又死循环了,让我输入密码。看日志里这个c/Users/wulf/.ssh目录下有啥东西,就发现原来这里有我的公钥:
$ cat /c/Users/wulf/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCf20s0rabgMRn8CCCCC/+VC/wS5x/dvIYoG+TP23bHWn9gD/AXizrkds5geX9AG90oVRqf+RfTvLFlaNMrzK
公钥太长,上面就只是随便贴了点。后来才发现linux上的服务端git根本不认识你,因为你有的是你自己的密码,人家那还没有你的公钥呢,得去它那里设置一下。
登陆linux下的111.11.111.11,把上面那段公钥贴到服务端authorized_keys里:
vi /home/git/.ssh/authorized_keys
贴好后保存后再去windows的git bash本地连下,这次ok了:
$ git clone git@111.11.111.11:code.git
Cloning into 'code'...
warning: You appear to have cloned an empty repository.
git连接报错:Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)的更多相关文章
- Visual Studio Code 使用 Git插件报错 - Permission denied (publickey)
在使用GitHub的时候,为了避免每次输入用户名密码,都会使用SSH方式代替Https. 按网上教程,大多数使用SSH-KeyGen生成公私钥对,而后上传公钥至Github,并切换Repositori ...
- Mac ssh 连接报错 Permission denied (publickey)
用的阿里云服务器,如果直接连接,会报下面错误: $ ssh root@47.94.132.115 Permission denied (publickey). 创建服务器的时候,连接秘钥会生成并下载到 ...
- IDEA中使用git报错Permission denied (publickey)
最近在使用idea开发时,使用git拉取远程仓库的代码时,报错Permission denied (publickey),原因是因为ssh的密钥失效,必须得重新设置下ssh的密钥即可. 命令很简单,在 ...
- 解决方案 git@github.com出现Permission denied (publickey)
ubentu 13.10 git version 1.8.3.2 解决方案:ssh -T git@github.com出现Permission denied (publickey).的问题 今天的任 ...
- 【转载】解决方案:git@github.com出现Permission denied (publickey)
遇到的问题 今天心血来潮,想将intellij上的项目代码放到GitHub上管理. 在进行添加远程库的时候,出现了:git@github.com出现Permission denied (publick ...
- Git push提交时报错Permission denied(publickey)...Please make sure you have the correct access rights and the repository exists.
一.git push origin master 时出错 错误信息为: Permission denied(publickey). fatal: Could not read from remote ...
- jenkins报错Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password) 的处理
问题背景:jenkins服务器发布代码后需要执行删除缓存的操作ssh -p222 eus_pe_devadmin@1.1.1.1 "sudo rm -rf /dev/shm/nginx/hi ...
- git push是报Permission denied (publickey)错误解决
今天晕了半天了,搞了个git工程到github上,以为很简单,因为之前也弄过,那知道搞了大半天都搞不好,一直报如下错误 D:\javawork\ee-0.0.1-SNAPSHOT>git pus ...
- git@github.com出现Permission denied (publickey)
上传项目的时候出现Permission denied (publickey)这个问题 解决方案如下: 看本地的.git/config设置的仓库url地址和github使用的链接地址是否一致如下图,如u ...
- ssh 密码连接报错 permission denied
背景:ssh连接openstack king时,出错permission denied (publickey,gssapi-keyex,gssapi-with-mic) 原因:king未开启ssh ...
随机推荐
- bzoj1606 / P2925 [USACO08DEC]干草出售Hay For Sale(01背包)
P2925 [USACO08DEC]干草出售Hay For Sale 简化版01背包(连价值都免了) 直接逆推解决 #include<iostream> #include<cstdi ...
- C++函数的返回值——返回引用类型&非引用类型
函数的返回主要分为以下几种情况: 1.主函数main的返回值: 允许主函数main没有返回值就可结束:可将主函数main返回的值视为状态指示器,返回0表示程序运行成功,其他大部分返回值则表示失败. 2 ...
- UVa 1210 连续素数之和
https://vjudge.net/problem/UVA-1210 题意: 输入整数n,有多少种方案可以把n写成若干个连续素数之和? 思路: 先素数打表,然后求个前缀和. #include< ...
- android:点击popupwindow以外区域 popupwindow自动消失
方法一(这种方法可以处理popupwindows dimiss的时候一些其他的操作,比如让其他控件的隐藏,消失等): 代码如下popupWindow.setFocusable(false);//foc ...
- 【Android】冷门常用 ADB
清除应用缓存adb shell pm clear 包名 获取手机中安装的包名,加上部分包名可以做筛选 adb shell pm list package adb shell pm list packa ...
- 雷林鹏分享:Ruby Web Services 应用 - SOAP4R
Ruby Web Services 应用 - SOAP4R 什么是 SOAP? 简单对象访问协议(SOAP,全写为Simple Object Access Protocol)是交换数据的一种协议规范. ...
- php--------网页开发实现微信JS的(定位,地图显示,照片选择功能)
今天说说微信网页开发中一下JS的功能,分享一下,希望对各位有所帮助. 前提:要有公众号,和通过微信认证,绑定域名,得到相应信息,appid,appsecret等. 微信开发文档:https://mp. ...
- PHP与Java集成开发详解(一)
很久以前,有人从www上看到看到天空上一个很亮的亮点,它就是Java语言,与此同时,在另一个地方一位梦想家也看到了一个亮点,它就是PHP. 时间一天天过去,这两个亮点也变得越来越亮,很快,它们受到了编 ...
- laravel中资源路由的控制器创建方法:
php artisan make:controller Admin\ArticleController --resource 上面的创建方法是,创建控制器文件夹下的Admin文件下的ArticleCo ...
- HDU 6153 A Secret(扩展kmp)
A Secret Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 256000/256000 K (Java/Others)Total ...