作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我已经添加了一个新的公钥来登录我的服务器。
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/
我是一名优秀的程序员,十分优秀!