git - Git 正在寻找错误的 SSH 密钥
问题描述
我决定尝试使用 SSH 来处理我的 GitHub 存储库。我在 git/.config 中修改了远程 url,所以现在它使用 SSH:
[remote "origin"]
url = git@github.com:keddad/passpoint_server.git
fetch = +refs/heads/*:refs/remotes/origin/*
但是,例如,当我运行git fetch时,git 正在寻找错误的密钥:
(venv) keddad@keddad-pc:~/PycharmProjects/passpoint_server/.git$ git fetch
no such identity: /home/keddad/.ssh/github_rsa: No such file or directory
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
同时,添加到 GitHub 的真正密钥在文件中~/.ssh/id_rsa 如何让 git 使用id_rsa密钥?
解决方案
看起来我的 ~/.ssh/config 配置不当:
Host github.com
IdentityFile ~/.ssh/github_rsa
IdentitiesOnly yes
我需要将 IdentityFile 更改为真实文件,在我的情况下,id_rsa
Host github.com
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
推荐阅读
- python - 使用请求python在亚马逊获取联系我们页面的问题
- calculated-columns - 从具有最高值的行返回地址并对所有值列求和
- python - 让 pandas 将 hive 的 collect_list 读取为 python 列表
- sql - SQL - 框内查找框
- python - 使用 Apache 部署 Django App 时出现禁止错误
- python - 使用python从网页中提取数据
- kubernetes - 如何在 Kubernetes 中配置 PrestoDB 内部通信
- python - 在 Python 中格式化字符串需要一些帮助
- php - 如何在 Laravel 8.* 中从数据库中删除数据
- node.js - 续集“自引用超多对多关系”