linux下gitにPermission denied(publickey)が現れる.fatal:リモートウェアハウスを読み込めません.

2025 ワード

背景:
marhal@php-ubuntu18:/var/www/html$  composer create-project laravel/laravel Laravel-1 --prefer-dist "5.8.*"
marhal@php-ubuntu18:/var/www/html/Laravel-1$ sudo chown -R www-data:www-data bootstrap/
marhal@php-ubuntu18:/var/www/html/Laravel-1$ sudo chown -R www-data:www-data storage/
marhal@php-ubuntu18:/var/www/html/Laravel-1$ cd
marhal@php-ubuntu18:~$ git config --global user.name 'Marhal'
marhal@php-ubuntu18:~$ git config --global user.email '[email protected]'
marhal@php-ubuntu18:~$ git config --global push.default simple
marhal@php-ubuntu18:~$ cd /var/www/html/Laravel-1/
marhal@php-ubuntu18:/var/www/html/Laravel-1$ git init
       Git     /var/www/html/Laravel-1/.git/
marhal@php-ubuntu18:/var/www/html/Laravel-1$ git add -A
marhal@php-ubuntu18:/var/www/html/Laravel-1$ git commit -m "init projext"
marhal@php-ubuntu18:/var/www/html/Laravel-1$ git remote add origin [email protected]:Marhal/Laravel-1.git
marhal@php-ubuntu18:/var/www/html/Laravel-1$ git push -u origin master
The authenticity of host 'code.aliyun.com (120.55.150.20)' can't be established.
RSA key fingerprint is SHA256:ZrA2ZqYTVyPbw4zytCSAv74ZMaS2LDH74I7sMPtQIG0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'code.aliyun.com,120.55.150.20' (RSA) to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal:         。

                  。

ソリューション:
marhal@php-ubuntu18:~$ ssh-keygen -t rsa -C "[email protected]"

いっしょに車に戻る
marhal@php-ubuntu18:~$ cd /home/marhal/.ssh/
marhal@php-ubuntu18:~/.ssh$ ls
id_rsa  id_rsa.pub  known_hosts
marhal@php-ubuntu18:~/.ssh$ cat id_rsa.pub 
ssh-rsa      [email protected]


id_のコピーrsa.pubの内容はコード管理プラットフォームにssh鍵を追加します.
追加後のテストが成功したかどうか
marhal@php-ubuntu18:~$ ssh code.aliyun.com
Connection to code.aliyun.com closed by remote host.
Connection to code.aliyun.com closed.