git - 安装 zsh 后无法通过 ssh 提交到 github 远程
问题描述
我有 SSH 密钥与我的 Win10 机器和 Github 帐户配对,它正在 Bash 上运行,但今天我通过 WSL 安装了 ZSH (oh-my-zsh),现在当我尝试推送时,我看到了下一个错误:
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.
在ZSH 中:
ssh -T -ai ~/.ssh/id_rsa git@github.com
git@github.com: Permission denied (publickey).
在重击中:
$ ssh -T -ai ~/.ssh/id_rsa git@github.com
Hi UserName! You've successfully authenticated, but GitHub does not provide shell access.
解决方案
我在 Ubuntu (WSL2) 上安装了 ZSH,以便按照您的步骤操作。就我而言,我可以通过 ZSH shell 推送到远程。问题似乎出在 WSL 内的 SSH 密钥中。按照该步骤生成另一个密钥以在您的 WSL 中配对。
之所以如此,是因为您从 Windows 获取的第一个 SSH 密钥位于一个位置,而您现在需要的 SSH 密钥需要放在 WSL 中。
推荐阅读
- oop - 我们可以覆盖 C++ STL 容器的功能吗?
- postgresql - 如何仅提取 AWS RDS(Postgres 数据库)中的更改数据(CDC)并将更改数据转储到另一个 RDS postgres 实例?
- ruby - 是否有 ruby 方法可以在其他字符串之间选择字符串?
- c# - DataTable 行比较与 C# 中略有不同的模式
- spring - spring 中的每个实例化类是否都从 application.properties 文件中加载默认变量?
- javascript - 通过 UID 从 firebase 获取用户
- rust - 如何反序列化带有可选内部标签的枚举?
- internet-explorer - IE 和 Edge 上的网页下拉菜单
- html - 如果一行中的列不适合屏幕,则使该列显示垂直滚动条
- python - 如何对复杂的 Python 列表进行排序?