CentOS 8解决ssh连接github时sign_and_send_pubkey失败问题

我在一台centos8机器上安装git环境以连接到github,首先第一步需配置好ssh环境,因为我已经有一台Ubuntu机器已经配置好ssh环境,所以我ftp Ubuntu机器取得id_rsa id_rsa.pub known_hosts三个文件,然后执行命令:

$ git clone git@github.com:your-username/learning_log.git

Cloning into 'learning_log'...

Warning: Permanently added the ECDSA host key for IP address '20.205.243.166' to the list of known hosts.

sign_and_send_pubkey: signing failed: agent refused operation

git@github.com: Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

明显失败了

然后执行以下命令直接用ssh测试:

$ ssh -T git@github.com

sign_and_send_pubkey: signing failed: agent refused operation

git@github.com: Permission denied (publickey).

还是失败

然后执行:

eval "(ssh-agent -k)"

SSH_AGENT_PID not set, cannot kill agent

eval "(ssh-agent -s)"

Agent pid 35072

然后执行:

$ ssh -T git@github.com

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@ WARNING: UNPROTECTED PRIVATE KEY FILE! @

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Permissions 0664 for '/home/zhang/.ssh/id_rsa' are too open.

It is required that your private key files are NOT accessible by others.

This private key will be ignored.

Load key "/home/zhang/.ssh/id_rsa": bad permissions

git@github.com: Permission denied (publickey).

毛病找到了,是密钥文件的权限问题。然后执行:

$ chmod 600 id*

$ chmod 644 k*

然后执行:

$ ssh -T git@github.com

Hi your-username! You've successfully authenticated, but GitHub does not provide shell access.

问题总结:是因为我ftp Ubuntu机器get密钥文件到本地的时候权限变了,ssh代理拒绝代理了。

相关推荐
z***43841 天前
SQL server配置ODBC数据源(本地和服务器)
运维·服务器·github
无限进步_1 天前
C语言动态内存管理:掌握malloc、calloc、realloc和free的实战应用
c语言·开发语言·c++·git·算法·github·visual studio
字节跳动开源1 天前
AIBrix v0.5.0 正式发布:实现批量API支持、KVCache v1连接器升级,全面提升P/D架构协同效能
开源·github·资讯
用户345848285051 天前
Java内存模型如何保证有序性?
github
HelloGitHub1 天前
比 MySQL 轻,比 SQLite 强:终于有人把 AI 数据库做对了
数据库·开源·github
艾莉丝努力练剑1 天前
【Linux基础开发工具 (四)】Linux编程基础:深入理解gcc / g++编译与链接原理
linux·运维·服务器·c++·人工智能·ubuntu·centos
小雪_Snow2 天前
CentOS 7 安装 docker 教程
linux·docker·centos
知行力2 天前
【GitHub每日速递 20251119】免费开源全学段数学教材,打破教育资源获取壁垒!附文件合并及下载攻略
github
whysqwhw2 天前
kotlin-7
github
whysqwhw2 天前
kotlin-5
github