문제 설명:
Git은 gitlab 웨어하우스에서 코드를 다운로드하고 http를 이용하여 사용할 수 있지만 ssh 다운로드는 항상 비밀번호를 보고해야 하며 비밀번호가 잘못 입력되었습니다.
[root@web-m data]# git clone ssh://[email protected]:22022/lxk/core.git
Cloning into 'core'...
[email protected]'s password:
Permission denied, please try again.
[email protected]'s password:
Permission denied, please try again.
[email protected]'s password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
해결책:
1. ssh 키 생성
ssk-keygen을 입력한 후 enter를 누르고 기본 매개변수를 사용합니다.
/.ssh$ ssh-keygen
Enter file in which to save the key (/home/airgens/.ssh/id_rsa):
2. 공개 키를 로드합니다.
ssh 추가 ~/.ssh/id_rsa
ssh-add ~/.ssh/id_rsa
위 작업에 오류가 있는 경우:
에이전트가 키를 사용한 서명 실패를 인정함
그런 다음 실행해야합니다
ssh-agent bash --login -i
3. gitlab 관리 페이지에서 ssh-key를 추가해야 합니다.
cat id_rsa.pub 콘텐츠를 다음 위치에 복사합니다.
4. 확인 확인
xxg@ubuntu:~/.ssh$ git clone [email protected]:cszsfs/Android11.0.git
Cloning into 'Android11.0'...
^Cmote: Enumerating objects: 713441
분석하다:
로컬 ssh에서 생성한 키가 ssh 에이전트에 추가되지 않는 문제