Viki

Viki 写东西的地方

努力上进且优秀
github
email
x
steam
bilibili
douban

Resolve git/ssh error: too many authentication failures

The main reason is that there are too many host rules configured for ssh, and there is no precise matching set. Additionally, with multiple keys present, ssh attempts each one, and before a successful match is found, it gets rejected by the server due to too many failed attempts.

Solution: Add precise matching in the host matching rules.

# ~/.ssh/config

Host gitlab.xxx.com
  HostName gitlab.xxx.com
  User root
  IdentityFile ~/.ssh/other_rsa
  # Add the following line for precise matching of the corresponding key
  IdentitiesOnly yes
  # And do not use any agent
  IdentityAgent none

# GitHub
Host github.com
  # for 443 port
  HostName ssh.github.com
  User git
  Port 443
  IdentityFile ~/.ssh/viki_rsa
  IdentitiesOnly yes

Host *
  User root
  IdentityFile ~/.ssh/viki_rsa
  PreferredAuthentications publickey
  IdentityAgent "xxx"
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.