I recommend using PHP Deployer https://github.com/deployphp/deployer/ , but in your case it just seems your public key is not being accepted so add your public ssh key to the server's authorized ssh keys and that should solve your issue.
Sep 14, 2021
3
Level 1
How to push Codes from VScode to Server using SSH-PrivateKey
Hi there I have a new server that i want to move my website to it. before i use a Git Remote :
git remote add production ssh://[email protected]:420/var/repo/site.git
And to access this server I used a Password to push my codes, Site.git is a git Hook and this file push the changes to main folder /var/www/mySite.
Now I set the SSH-Keys, but i can't to do that again, i must to set a Hostname on Git Config file in .ssh Folder like this :
Host myhost
HostName 185.***.***.123
Port 420
User admin
IdentityFile ~/.ssh/ar-privatekey.pem
IdentitiesOnly yes
AddKeysToAgent yes
// with this Remote
git remote add production roy@myhost:/var/repo/site.git
// roy is that user that i set in git Config global.
with this, I can Conect to this server using git Command == 'ssh myhost' with no problem, But when i want to Push or Clone all of my codes, its givrs me this error :
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
??????? ThankYou
Please or to participate in this conversation.