gpt4 book ai didi

git - 告诉 git 忽略我的 RSA 公钥

转载 作者:太空狗 更新时间:2023-10-29 13:41:12 25 4
gpt4 key购买 nike

我已经添加了一个新的公钥来登录我的服务器。

git 正在尝试为 bitbucket 使用相同的 key ,但失败了,git 无法使用,因为它正在尝试使用该公钥。

是否有 git 的配置选项告诉它忽略我已有的公钥?

我试图通过使用这个 https://confluence.atlassian.com/pages/viewpage.action?pageId=271943168 来设置多个 ssh 身份但它失败了,git 仍然无法工作。

与其设置一个全新的 key ,我只想让 git 完全忽略该 key 。

编辑

我当前的 ssh 配置如下所示

ServerAliveInterval 15
ServerAliveCountMax 3

Host bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/bitbucket

最佳答案

我想问题出在您的存储库的 URL 上。需要对其进行调整以使用在 ~/.ssh/config 中创建的别名:

git remote set-url origin git@bitbucket:path/to/repo.git

另外,你可以让你的 ~/.ssh/config 看起来像这样:

ServerAliveInterval 15
ServerAliveCountMax 3

Host bitbucket
HostName bitbucket.org
User git
IdentityFile ~/.ssh/bitbucket

注意 User 键的存在。这将告诉 ssh,无论何时您使用别名 bitbucket 也使用用户名 git。上面的命令可以变成:

git remote set-url origin bitbucket:path/to/repo.git

此外,无论何时克隆,您都可以:

git clone bitbucket:path/to/repo.git

还可以节省您的打字时间。

关于git - 告诉 git 忽略我的 RSA 公钥,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19617684/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com