git - 无法推送到克隆的仓库
问题描述
从 Github 迁移到 Gitlab。克隆了存储库,设置了我的密钥等。我正在使用 GitKraken(之前使用的是 sourcetree,但已切换)。
问题:对 Gitlab 的推送尝试在一个 repo 上失败,并显示“git@gitlab.com: Permission denied (publickey)”。
我在 GitKraken 中创建了一个新的存储库,将其设置为私有,并且能够通过 ssh 将多个提交通过 GitKraken 推送到 Gitlab 而不会出现问题。这告诉我密钥或类似的东西没有实际问题,而且这个错误有点误导。两个 Repos 的设置相同,都是私有的,使用 SSH 并启用了 LFS。
当我推送到我从 github 克隆的 repo 时,它会抛出这个错误,告诉我一定有某种配置问题或其他东西,但我在这方面有点新手,不知道去哪里检查重置这种东西。
编辑:我在两个存储库上都运行了 ssh -vT git@gitlab.com。两者都以:
debug1: Authentications that can continue: publickey
debug1: Trying private key: /c/Users/crossmr/.ssh/id_dsa
debug1: Trying private key: /c/Users/crossmr/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/crossmr/.ssh/id_ed25519
debug1: Trying private key: /c/Users/crossmr/.ssh/id_xmss
debug1: No more authentication methods to try.
git@gitlab.com: Permission denied (publickey).
然而,我通过 gitkraken 创建的 repo 也返回了完全相同的输出,我可以很好地推送它。
出于测试目的,我生成了一组全新的密钥,现在在 bash 上收到:
$ ssh -T git@gitlab.com
Enter passphrase for key '/c/Users/crossmr/.ssh/id_rsa':
Welcome to GitLab, @crossmr!
但是,当我现在尝试使用 GitKraken 推送时,GitKraken 告诉我:“配置的 SSH 密钥格式无效”。
然而 bash 界面完全没有问题
Edit2:GUI 错误的图像
这是当前的 GUI 错误,而通过 bash 推送给了我:
$ git push Gitlab master
Enter passphrase for key '/c/Users/crossmr/.ssh/id_rsa':
Uploading LFS objects: 100% (18/18), 38 MB | 1.4 MB/s, done
Enumerating objects: 99, done.
Counting objects: 100% (99/99), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (72/72), done.
Writing objects: 100% (72/72), 7.07 KiB | 452.00 KiB/s, done.
Total 72 (delta 38), reused 0 (delta 0)
To gitlab.com:crossmr/repo.git
4ccee92..d32d232 master -> master
解决方案
推荐阅读
- azure - 使用 Azure B2C 调用 Microsoft 图形 API
- python - 如何在 Azure Blob 中上传大字符串?
- css - 如何将文本右侧的图标与图标列表元素模块对齐?
- ms-word - MS Word Legacy Form Text Form Field 限制编辑,除了更改字体大小
- node.js - 类型错误:期望 `options.agent` 属性为 `http`、`https` 或 `http2`,得到 `options`
- javascript - JavaScript 构造函数的语法糖
- json - MarkLogic 协调数据清洗如何解析数据并分离成
- java - 将数据从片段保存到文件 AndroidStudio
- java - 使用 JavaFX 创建一个带有“wait()”的任务
- json - 从各种类型的 JSON 值流中展开数组