git에게 rsa 키를 사용하지 않고 사용자 이름 + 비밀번호를 사용하도록 지시하는 방법

git에게 rsa 키를 사용하지 않고 사용자 이름 + 비밀번호를 사용하도록 지시하는 방법

내 SSH 구성을 망친 것 같아요.

최근에는 더 이상 로컬 저장소를 복제할 수 없습니다. git 저장소가 공개 키와 비밀번호를 모두 허용하는 것 같지만 두 옵션 중 하나를 선택하는 대신 잘못된 RSA 키를 사용하여 연결을 시도하면 다음 메시지가 나타납니다.

Received disconnect from myRemoteComputer : Too many authentication failures for myUsername
fatal: Could not read from remote repository.

해당 컴퓨터에 SSH를 통해 접속할 때도 마찬가지입니다.

$ssh -v myRemoteComputerIP
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/myUsername/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: myUsername@cvg04
Received disconnect from myRemoteComputerIP: Too many authentication failures for myUsername

최근에 두 명령이 모두 작동했기 때문에 문제가 발생했습니다. 기본적으로 잘못된 "RSA 키"를 무작위로 선택하는 대신 사용자 이름과 비밀번호를 알려주고 사용해야 ssh합니다 . git이거 수리하는 방법 아시는 분 계신가요?

또한 최근 포럼의 조언에 따라 몇 가지 명령을 실행했지만 ssh-add문제의 일부일 수도 있습니다.

답변1

. ~/.ssh/config​비밀번호 인증을 사용하려면 다음과 같이 설정하면 됩니다.

Host myRemoteComputerIP
  PubkeyAuthentication no

이 호스트에 대해 공개 키 인증을 시도하지 않습니다.


rsa 키와 다른 사용자 이름/passwd 인증을 사용하여 두 개의 다른 사용자 이름으로 연결해야 하는 경우는 어떻습니까?

다음에서 별칭을 사용할 수 있습니다 ssh_config.

Host alias1
  Hostname myRemoteComputerIP
  PubkeyAuthentication no
  User user1
Host alias2
  Hostname myRemoteComputerIP
  # PubkeyAuthentication yes # is default
  User user2

그런 다음 ssh alias1및 을 사용하여 연결합니다 ssh alias2.

답변2

https를 사용하여 복제하면 항상 비밀번호를 묻습니다. 예:

git clone https://github.com/my_company/myrepo.git

관련 정보