Как настроить ssh для git на сервере?
Не могу никак сделать git pull с помощью GitHub Actions. Дано - репозиторий на GitHub, сервер и, собственно, сайт.
Зашел на сервер, создал ключи
ssh-keygen -t ed25519 -C "[email protected]"
Сделал
$ eval "$(ssh-agent -s)"
и добавил ключ
ssh-add ~/.ssh/id_ed25519
После этого в папке .ssh сделал файл config и прописал
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519
Добавил на github публичный ключ
Сделал проверку на сервере
ssh -T [email protected]
Enter passphrase for key '/home/user/.ssh/id_ed25519': Hi User! You've successfully authenticated, but GitHub does not provide shell access.
Все вроде ок. При первой попытке action с workflow ругалось на то, что права у ключей слишком расширены — сделал chmod 400 на оба.
Получаю в action github
err: OpenSSH_8.4p1 Debian-5+deb11u1, OpenSSL 1.1.1n 15 Mar 2022
err: debug1: Reading configuration data /home/***/.ssh/config
err: debug1: /home/***/.ssh/config line 1: Applying options for github.com
err: debug1: Reading configuration data /etc/ssh/ssh_config
err: debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
err: debug1: /etc/ssh/ssh_config line 21: Applying options for *
err: debug1: Connecting to github.com [140.82.121.4] port 22.
err: debug1: Connection established.
err: debug1: identity file /home/***/.ssh/id_ed25519 type 3
err: debug1: identity file /home/***/.ssh/id_ed25519-cert type -1
err: debug1: Local version string SSH-2.0-OpenSSH_8.4p1 Debian-5+deb11u1
err: debug1: Remote protocol version 2.0, remote software version babeld-1b199b0f
err: debug1: no match: babeld-1b199b0f
err: debug1: Authenticating to github.com:22 as 'git'
err: debug1: SSH2_MSG_KEXINIT sent
err: debug1: SSH2_MSG_KEXINIT received
err: debug1: kex: algorithm: curve25519-sha256
err: debug1: kex: host key algorithm: ecdsa-sha2-nistp256
err: debug1: kex: server->client cipher: [email protected] MAC: compression: none
err: debug1: kex: client->server cipher: [email protected] MAC: compression: none err: debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
err: debug1: Server host key: ecdsa-sha2-nistp256 SHA256:p2QAMWu3/LiyfQM
err: debug1: Host 'github.com' is known and matches the ECDSA host key.
err: debug1: Found key in /home/***/.ssh/known_hosts:1
err: debug1: rekey out after 134217728 blocks
err: debug1: SSH2_MSG_NEWKEYS sent
err: debug1: expecting SSH2_MSG_NEWKEYS
err: debug1: SSH2_MSG_NEWKEYS received
err: debug1: rekey in after 134217728 blocks
err: debug1: Will attempt key: /home/***/.ssh/id_ed25519 ED25519 SHA256:wBeVhufWuxwTRo explicit
err: debug1: SSH2_MSG_EXT_INFO received
err: debug1: kex_input_ext_info: server-sig-algs=<[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa>
err: debug1: SSH2_MSG_SERVICE_ACCEPT received
err: debug1: Authentications that can continue: publickey
err: debug1: Next authentication method: publickey
err: debug1: Offering public key: /home/***/.ssh/id_ed25519 ED25519 SHA256:OAZaccdgduVhufWuxwTRo explicit
err: debug1: Server accepts key: /home/***/.ssh/id_ed25519 ED25519 SHA256:OAZ71DHXwBeVhufWuxwTRo explicit
err: debug1: read_passphrase: can't open /dev/tty: No such device or address err: debug1: No more authentication methods to try.
err: [email protected]: Permission denied (publickey). err: fatal: Could not read from remote repository. err: Please make sure you have the correct access rights err: and the repository exists.
Что еще ему нужно?